Skip to main content
Sep 20, 2019 12:24 AM UTC
Question

"Application Development Tips & Tricks" guide is not outputting results

 

 

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?

"ThingTemplates [" LinePartTemplate "]. GetImplementingThingsWithData ();" The data should come from the code but it's not coming out.
Is there a way to put data into ThingTemplates ["LinePartTemplate"]?

 

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);
}
}

1 reply

Sep 20, 2019 4:39 AM UTC

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

message-id39282.PNG

 

Regards,

Saran