Skip to main content
1-Visitor
March 6, 2019
Question

Property Categories

  • March 6, 2019
  • 1 reply
  • 2302 views

I want to use categories to organize my properties on a Thing. Is there a way to get the list of categories implemented by the Thing? Preferably without having to get ALL of the Property Definitions and then running a Distinct snippet on the Category field.

I also want to avoid using Thing Shapes as a way of organizing the properties. We have instances of multiple Things needing to implement the same Shape but having wildly different properties and thus, doubling the size of the Shape actually needed for each Thing.

1 reply

20-Turquoise
March 11, 2019

You can assign more than one Thing Shape to a Thing. It would probably be the best method for your use case,

agondek1-VisitorAuthor
1-Visitor
March 11, 2019

@posipova this does not answer my original question of whether or not there is a way to return a list of implemented categories on a Thing. It also does not solve the problem of a single shape being used by two things while needing two very different sets of properties.

20-Turquoise
March 11, 2019

There is no out of the box functionality to return such a list but you could perhaps look into utilizing GetPropertyDefinitions service:

var result = Thing[Name].GetPropertyDefinitions({
category: undefined /* STRING */,
type: undefined /* BASETYPENAME */,
dataShape: undefined /* DATASHAPENAME */
});

 

 

There is also probably some misunderstanding. What I meant was that a Thing can use more than one Thing Shape. So  Thing Shape 1 with one set of properties can be assigned to Thing A and Thing Shape 2 with a different set of properties can be assigned to Thing B, then Thing Shape 3 can hold common properties and be shared between Thing A and B.