Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
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
Solved! Go to Solution.
If you use Contained mashups you can dynamically change out the actual mashup / grid to match your service
If you check show all columns on a grid you can show data without a datashape
I think in one of the newer grid versions (from the market place?) you might be able to assign the datashape on the fly, uncertain about that.
If you use Contained mashups you can dynamically change out the actual mashup / grid to match your service
If you check show all columns on a grid you can show data without a datashape
I think in one of the newer grid versions (from the market place?) you might be able to assign the datashape on the fly, uncertain about that.