cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How to add the field definitions to infotable at runtime and map the dynamic results to Grid

vi1
15-Moonstone
15-Moonstone

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:vi1)

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.

View solution in original post

1 REPLY 1
PaiChung
22-Sapphire I
(To:vi1)

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.

Top Tags