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

While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate

SOLVED
Highlighted
Newbie

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

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate

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.

8 REPLIES 8

Re: While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate

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.

Re: While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate

What I am trying to do is while creating a new thingtemplate, compare the properties names again existing thingtemplates

Re: While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate

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.

Re: While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate

now my question is which service to execute in order to get the list of thingtemplate exisiting on tw?

Re: While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate

You should be able to use GetEntityList specifying thing template as the type.

Re: While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate

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.

Re: While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate

just one thing, I do not find the GetProperties service

Re: While creating a thingtemplate,how to compare thingtemplate's properties name against existing thingtemplate

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.