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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

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

aluna
1-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

1 ACCEPTED SOLUTION

Accepted Solutions
posipova
20-Turquoise
(To:aluna)

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.

View solution in original post

8 REPLIES 8
posipova
20-Turquoise
(To:aluna)

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.

aluna
1-Newbie
(To:posipova)

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

posipova
20-Turquoise
(To:aluna)

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.

aluna
1-Newbie
(To:posipova)

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

posipova
20-Turquoise
(To:aluna)

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

ankigupta
5-Regular Member
(To:aluna)

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.

just one thing, I do not find the GetProperties service

posipova
20-Turquoise
(To:aluna)

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.

Top Tags