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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Create a property that represents a list of things

jsladojevic
1-Visitor

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
smayer
12-Amethyst
(To:jsladojevic)

Hi Jovan

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

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?

smayer
12-Amethyst
(To:jsladojevic)

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.

drichter
15-Moonstone
(To:jsladojevic)

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

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.

drichter
15-Moonstone
(To:jsladojevic)

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.

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.

Announcements


Top Tags