5 Replies Latest reply on Dec 28, 2016 9:39 AM by carlesc RSS
    rkandasamy Apprentice

    Modifying Tag of "N" number of entities

    Hi Team,

     

    We are working on thingworx and have more than 200 entities. Say first 100 entities are tagged under "PojectA" and second 100 entities are tagged under "ProjectB".

    Now we want to unite modify both the tags to "ProjectMain" and we don't want to edit each entity for that. Is there any way to do it in bulk via any thingworx default servcies?. Please provide your suggestions.

    Thanks  in Advance.

      • Re: Modifying Tag of "N" number of entities
        carlesc Ninja

        Yes for sure,

         

        Just use Search Snippets to search entities, and then with Things[thingName].AddTags you can set it.

         

        Carles.

          • Re: Modifying Tag of "N" number of entities
            rkandasamy Apprentice

            Hi Carles,

             

            Thank you for the prompt response. I could not find the correct search snippet that retrieves the things based on model tag. It would be helpful if you could provide an example script for tag "ProjectA" in model tag Application. Thanks again.

              • Re: Modifying Tag of "N" number of entities
                carlesc Ninja

                var things = Resources["SearchFunctions"].SearchThings({

                maxItems: 1000000,

                searchExpression: "*",

                modelTags: "ModelTagName:TagName"

                });

                 

                for each(thing in things.rows[0].thingResults.rows) {

                  Things[thing.name].AddTags({ tags: "ModelTagName:NewTagName" });

                }

                  • Re: Modifying Tag of "N" number of entities
                    rkandasamy Apprentice

                    Hi Carles,

                     

                    Thanks. I was able to execute the service and the result contains datatables, things, thingtemplates,thingshapes,repositories for given tags ProjectA.

                    Also i am able to set the different tag as well.

                     

                    but i could not find entities like datatshapes, mashups. I tried getting the names for mashups from mashupResults in SearchAll,SearchThings snippet service, but could not get the same.

                    What needs to be done for  getting visualization entities like mashups, masters, gadgets with tags ProjectA?

                    What needs to be done for getting security entities like , user groups,users, organizations with tags ProjectA?

                    Please provide your suggestions.

              • Re: Modifying Tag of "N" number of entities
                carlesc Ninja

                You have a SearchAll where on types you can pass the types of entities to search for. To pass the entity types, you should use:

                 

                types: { items: ["DataShape","DataTagVocabulary",... ] }