While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate
While creating a thingtemplate,and want compare thingtemplate's properties names against existing thingtemplate properities name, I want to validate that we reuse thingtemplate and do not create if there is one that have the necessary properties
Solved! Go to Solution.
- Labels:
-
Extensions
- Tags:
- properties
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
It's not available on the template level, but you may try to use GetInstancePropertyDefinitions with the infotable returned. Please keep in mind you cannot "test" a service on the template level, you would have to create a new service in a thing and access the template services through it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Could you please clarify - you are creating a thingtemplate and comparing the property names against a different thingtemplate? Or adding new properties to the newly created thingtemplate and comparing them to the existing ones in the same template?
You may use try/catch and run a service on the property, if it doesn't exist and you get an error, then proceed to creating one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
What I am trying to do is while creating a new thingtemplate, compare the properties names again existing thingtemplates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Such a service is not available out of the box. What I see as a workaround/potential solution, is to keep all existing properties in some datatable, then checking for a matching entry before creating a new property. Or running the GetProperties service that returns an infotable and comparing the row value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
now my question is which service to execute in order to get the list of thingtemplate exisiting on tw?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You should be able to use GetEntityList specifying thing template as the type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi armando luna, If this Issue is resolved; could you please mark correct answer to let other members know that this Thread has a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
just one thing, I do not find the GetProperties service
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
It's not available on the template level, but you may try to use GetInstancePropertyDefinitions with the infotable returned. Please keep in mind you cannot "test" a service on the template level, you would have to create a new service in a thing and access the template services through it.
