Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hello.
I would like to combine 3 the contents (Things) from three different thing template and output these things onto a list. I have tried multiple ways still I get errors.
Please can you give me suggestions.
Regards.
Solved! Go to Solution.
@Janicen : Created a sample service. Please check below.
// result: INFOTABLE dataShape: "RootEntityList"
let thinglist = ThingTemplates["testTT"].GetImplementingThings(); //Get all things associated with testTT thing template
var thingName;
var params = {
infoTableName: "MyInfoTable",
dataShapeName: "nameds"
};
var MyInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params); // Creating an empty infotable from 'nameds' data shape which has a 'name' field with 'String' as base type
for each (var row in thinglist.rows) {
// Now each row is already assigned to the row variable in the loop
thingName= row.name;
MyInfoTable.AddRow({name: thingName}); // adding name of things in the rows of infotable
}
me.info1=MyInfoTable; //Here on the last row I am storing the thing names in an infotable property
@Janicen Can you please provide more details? What exactly you are combining in Things and where? Whats the error are you getting?
Hello @abjain
I have three thing templates. Each template contains things.
I want to output a list that has the names of the things found inside of each template.
The aim is to have 3 different infotables each containing names of things from the three different templates. Then have one combined infotable to store all the thing names from each infotable.
Each one of these infotables make use of the same Datashape.
What I have currently:
1. Created empty 3 infotables (each template can store the names of its things inside an infotable )
2. I used the getImplentingThings service to output the names of things (the output type is infotable)
3. I need to find a way to populate the empty infotables with the names of things
4. I will need a combined infotable that will aggregate the 3 infotables.
I am stuck on completing step 3.
Any suggestions?
@Janicen : Created a sample service. Please check below.
// result: INFOTABLE dataShape: "RootEntityList"
let thinglist = ThingTemplates["testTT"].GetImplementingThings(); //Get all things associated with testTT thing template
var thingName;
var params = {
infoTableName: "MyInfoTable",
dataShapeName: "nameds"
};
var MyInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params); // Creating an empty infotable from 'nameds' data shape which has a 'name' field with 'String' as base type
for each (var row in thinglist.rows) {
// Now each row is already assigned to the row variable in the loop
thingName= row.name;
MyInfoTable.AddRow({name: thingName}); // adding name of things in the rows of infotable
}
me.info1=MyInfoTable; //Here on the last row I am storing the thing names in an infotable property
This gives the desired output, additionally I made a nested for loop that will iterate through the different templates and output the thing names from each template.
Many thanks.