How to add the field definitions to infotable at runtime and map the dynamic results to Grid
Hi,
I am having the 2 different infotable with different fields .
Based on Condition , I want to show one infotable results to Grid.
How to add the dynamic field definitions and assign the results to Grid.
Field definition base type are String and Image type.
Below is the code written in the service.
var params = {
infoTableName : "InfoTable",
dataShapeName : "DataShape1"
};
var outputInfotable1 = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
var params = {
infoTableName : "InfoTable",
dataShapeName : "DataShape2"
};
var outputInfotable2 = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
//Creating Dynamic Infotable with no Datashape
var params = {
infoTableName: "MyInfoTable"
};
var result= Resources["InfoTableFunctions"].CreateInfoTable(params);
if(Condition)
{
var dataShapeFields = outputInfotable1.dataShape.fields;
}
else
{
var dataShapeFields = outputInfotable2.dataShape.fields;
}
for(var key in dataShapeFields) {
outputInfotable.AddField({ name: key, baseType: (""+dataShapeFields[key].baseType) });
}
for (var fieldName in dataShapeFields){
var dataobj = new Object();
......................................
.........................................
dataobj[fieldName] = image;//
result.AddRow(dataobj);
}.
After assigning the grid, i am getting junk data to image type field column. Getting the string type data correctly.
Could you please provide the example how to achieve?
Thank You

