Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
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?
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?
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.
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.
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.