Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
I have to display grid dynamically(But multiple rows in sql have to displayed in single row in grid). Its keep on change based on value selecting in combo box.
For eg:
am having this table in sql
Now this "wi_id" in combobox
Based on the selection i must diplay this field_name, and field_value.
But i must display in a single row. Here number of rows is not fixed. It keep on change
like this. Field_name becomes header, and field_value in rows. (eg: i took wi_id=3)
To get this result :
Get TAble From SQL
var params = {
WiName: WorkInstrn /* STRING */
};
// result: INFOTABLE dataShape: "BOBCAT_SpecifcationDetais_DS_C"
det = me.Wi_FieldDetails(params);
Create INfoTAble
var params = {
infoTableName: WorkInstrn/* STRING */
};
// result: INFOTABLE
a= Resources["InfoTableFunctions"].CreateInfoTable(params);
Add Field NAme for Created Infotable
for( i=0 ; i<det.length ;i++ )
{
var newField = new Object();
newField.name = det.rows[i].field_name;
newField.baseType = 'STRING';
a.AddField(newField);
}
Adding Row in Infotable
var newRow=new Object();
for(i=0 ; i<det.length ;i++ )
{
b=det.rows[i].field_name
c=det.rows[i].field_value
newRow.b=c ------------Here am getting issue. I couldnt give header dynamically.it takes 'b' as header ,not the value of b
}
a.AddRow(newRow);
var result=a
Give solution for this.How to achieve this. FOr this infotable , rows,field everyting have to change dynamically..