Skip to main content
1-Visitor
January 30, 2018
Question

Create a property that represents a list of things

  • January 30, 2018
  • 2 replies
  • 6625 views

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?

2 replies

1-Visitor
January 30, 2018

Hi Jovan

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

1-Visitor
January 30, 2018

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?

1-Visitor
January 30, 2018

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.

1-Visitor
January 30, 2018

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

1-Visitor
January 30, 2018

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.

1-Visitor
January 30, 2018

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.