Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi Jakub,
Sorry, this is old thread, but i am seeing same scenario for Mashup.
It worked for executing service in Composer, i can see the rows with data, but when it goes to Mashup, when i am assigning this infotable to gird, grid showing empty rows (no data) ?
is there anything that changed ? i am trying this snippet with Thingworx-SDK 8.3
below is my code.
@ThingworxServiceDefinition(name="getSampleInfotable", category="", isAllowOverride=true, description="")
@ThingworxServiceResult(name="result", baseType="INFOTABLE", description="Sample Infotable Service")
public InfoTable getSampleInfotable() throws Exception{
DataShapeDefinition dsd = new DataShapeDefinition();
dsd.addFieldDefinition(new FieldDefinition("field1", "NUMBER"));
dsd.addFieldDefinition(new FieldDefinition("field2", "NUMBER"));
dsd.addFieldDefinition(new FieldDefinition("field3", "NUMBER"));
InfoTable it = new InfoTable(dsd);
ValueCollection row = new ValueCollection();
Random rnd = new Random();
for(int i = 0; i < 10; i++) {
row.SetNumberValue("field1", new NumberPrimitive(rnd.nextInt(100)));
row.SetNumberValue("field2", new NumberPrimitive(rnd.nextInt(100)));
row.SetNumberValue("field3", new NumberPrimitive(rnd.nextInt(100)));
it.addRow(row.clone());
}
return it;
/*
ValueCollection params = new ValueCollection();
params.SetInfoTableValue("ServiceITParameterName", prop); // my service had just one parameter of type InfoTable
client.invokeService(ThingworxEntityTypes.Things, "ThingName", "ServiceName", params, 1500);
*/
}
If you are seeing the data with the Test button on the Composer, then for sure the problem it's with your mashup not with the Java code itself.