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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Filtering content for displaying in a List

byutz
1-Newbie

Filtering content for displaying in a List

How can I populate a list of Things, where each of the things share a common property?  The things are all created from the same template.  I have been trying to use the getimplementingthings service, but I cant see where it allows me to filter.

1 ACCEPTED SOLUTION

Accepted Solutions
paic
1-Newbie
(To:byutz)

You can use QueryimplementingThings but that will only allow you to filter on Values of properties.

If you need to filter on an actual Property definition, you will have to iterate and populate the information into a new table.

View solution in original post

6 REPLIES 6
paic
1-Newbie
(To:byutz)

You can use QueryimplementingThings but that will only allow you to filter on Values of properties.

If you need to filter on an actual Property definition, you will have to iterate and populate the information into a new table.

byutz
1-Newbie
(To:paic)

I ended up having to create a service to accomplish this task.  Maybe we can get some built in filtering in the next version

paic
1-Newbie
(To:byutz)

Even though we provide some base services that help filter, best practice is to create 'wrapped' services that use these base services so that you can properly secure them.

nd-3
1-Newbie
(To:byutz)

Brian, Could you share example of your service you have created? I've been struggling to accomplish similar task.

byutz
1-Newbie
(To:nd-3)

I am not sure if this is the best way to do it but it works!

var table1 = ThingTemplates["Thing1"].GetImplementingThingsWithData();

var table2 = ThingTemplate["Thing2"].GetImplementingThingsWithData();

var tableLength = table2.rows.length;

for (var x = 0; x < tableLength; x++) {

     var row = table2.rows;   

     table1.AddRow(row);

}

var Result=table1

You can also use the query services, and then there is a combine command that will combine 2 tables for you.

Hope this helps!

nd-3
1-Newbie
(To:byutz)

Thanks Brian!

Top Tags