Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I am following the example in the "Application Development Tips & Tricks" guide(https://developer.thingworx.com/en/resources/guides/application-development-tools-tips-tricks), but the result data does not come out normally. What's wrong?
The code is shown below :
var params = {
infoTableName : "InfoTable",
dataShapeName : "LinePartDataShape"
};
dataShapeName:STRING):INFOTABLE(LinePartDataShape)
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
var partList = ThingTemplates["LinePartTemplate"].GetImplementingThingsWithData();
var tableLength = partList.rows.length;
for (var x=0; x < tableLength; x++) {
var row = partList.rows[x];
if(1000 > TemperatureThreshold){
var newEntry = new Object();
newEntry.PartName = row.PartName; // STRING
newEntry.PartTemperature = row.PartTemperature; // NUMBER
result.AddRow(newEntry);
}
}
Hi @kikky_79 ,
It might be because that the "LinePartTemplate" is not implemented by atleast one thing.
Check if "var partList = ThingTemplates["LinePartTemplate"].GetImplementingThingsWithData();" is returning any result table.
If not then create a thing with the "LinePartTemplate" and try again. Then it should return the expected result table with the implemented things.
Another easy way to check this by viewing the "Uses This Entity" under the entity information of the Thing Template
Regards,
Saran