Skip to main content
1-Visitor
Jan 30, 2018 11:38 AM UTC
Question

Create a property that represents a list of things

Hello,

i'm creating a thing template and i want to add a property that represents a list(or an array of arbitrary length) of things all implementing a specific thing template, similar to the base type THINGNAME, but with multiple entries instead of one. How do i do that?

7 replies

1-Visitor
Jan 30, 2018 11:48 AM UTC

Hi Jovan

I'd suggest using an Infotable base type, this is the equivalent to an array in Thingworx.

Translate
1-Visitor
Jan 30, 2018 11:54 AM UTC

But infotables can only be based on data shapes and not on thing templates, so i have to create an extra data shape, that has a thingname implementing that template as a property. Is there no simplier solution?

Translate
1-Visitor
Jan 30, 2018 1:43 PM UTC

If you want to create a collection of elements of a defined type (this case ThingTemplateName) on a Thing, an Infotable with a defined data shape is the solution. If you find an alternative way please share.

Translate
1-Visitor
Jan 30, 2018 12:33 PM UTC

Instead of using a property for this, use the GetImplementingThings()-service of the template from which you want to know the implemented THINGNAMEs.

Translate
1-Visitor
Jan 30, 2018 1:06 PM UTC

well, i dont want all implemented things of this template.

For example:

I create a template called TyreSizes and a templatre called CarModel.

now i want each thing, that is a CarModel to have a property called possibleTyreSizes that tells me which TyreSizes-things are possible for this car Model.

Translate
1-Visitor
Jan 30, 2018 3:27 PM UTC

Ah ok, now I understand it.

I would suggest the solution of Sean Mayer​. But if the TyreSizes only a array of numbers like 20, 25, 28, 30 and you don't want use Infotables, you can use JSON for the possibleTyreSizes property.

Translate