Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
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.
You can assign more than one Thing Shape to a Thing. It would probably be the best method for your use case,
@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.
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.
Thanks for the confirmation that there is no OOTB functionality.
The solution you are proposing would not meet the use case because you cannot have duplicate Thing Shape names. The name of the Thing Shape is how we organize and group the properties together. Shape A vs Shape B would result in two different groupings which is not desired.