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

Create a property that represents a list of things

Level 1

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 7

Re: Create a property that represents a list of things

Hi Jovan

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

Re: Create a property that represents a list of things

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?

Re: Create a property that represents a list of things

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

Re: Create a property that represents a list of things

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.

Re: Create a property that represents a list of things

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.

Re: Create a property that represents a list of things

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.

Highlighted

Re: Create a property that represents a list of things

hi Jovan Sladojevic​, I dont know your exact use case but I think you should model such attributes in a Data table. For Example, store the list of tire sizes for each model and then query that table to show available sizes for a given model (if this is something user does through a UI while selecting vehicle options). Similarly you can model your Car entity as well to have a 'model' attribute which gets its list of possible model types from a Data Table.

With your current approach you will end up with too many model templates and other attribute templates (tire size for instance) which are redundant and will make model difficult to maintain and analyze as you extend this for other product lines.