Suppose I have a set of entities under some project and I want to change the model tags of of all the entities under that project with some custom service (without changing the vocabulary terms), what would be the snippet for this custom service?
Thanks in advance.
@RK_0705 : Please try add tags or set tags service for an entity as mentioned here: https://support.ptc.com/help/thingworx/platform/r9/en/index.html#page/ThingWorx%2FHelp%2FComposer%2F...
Actually what happens, all the entities are having different types like Mashups, Things, ThingTemplates etc so I am not able to write a single generic syntax in one code with passing input runtime entity type.
Actually I want to access these services with input as dynamic group type just like :-
where input is EntityType.
What would be the actual syntax for this scenario.
Just like.... Things[ThingName].AddTags() //default one
@RK_0705 : For each entity you will have then have to find its corresponding base type. For this you can utilize the service 'SearchModelEntities' in SearchFunctions resource. Attaching sample screenshot for its usage. After getting the type, in your service there should be conditional statements(like if/else) for each type where you can call the addatgs for specific type.
and so on....
I already have the type column with me using GetEntities service of Project.
This is the reason I asked this question because I don't want to write this AddTags, Remove Tags in every if statement.
I just want to get 'type group' from 'type' ("Things" from type "Thing")
and then assign it into one variable like "groupName" and gets automatically replaced dynamically with the respective 'type group' like Things, Datashapes,ThingTemplates etc in below syntax:-
@RK_0705 I tried this on my end and checked if we can use a variable to refer to different types in the syntax while adding tags for particular entity. Actually in services we refer to any entity by specifying its type like Things[thingname] or Mashups[name]. Now we cannot do this here:
I tried different combination of syntax here but 'groupname' in above cannot be dynamic. I think you will have to use conditional statements to group different entities types. Do you see any particular challenge in this approach?
Please let me know if you have found a solution with the help of one of the previous responses. If so, please mark the appropriate one as the Accepted Solution for the benefit of others with the same issue.
If you are still searching for a solution, please let us know.