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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How to search Things by name?

syu1
1-Newbie

How to search Things by name?

I have several Things named "thing1", "thing2", "thing3", "thing4", etc, which I want to delete. I am thinking of a way to first 'Find' or 'Query' or 'Search' the Things that begins with "thing" and then 'Delete' them. Nevertheless, I do not know which service to use to 'Find' or 'Query' or 'Search' Things.


Anybody knows what service do I need? Or is there any better solution to my intention?


thanks

1 ACCEPTED SOLUTION

Accepted Solutions
supandey
19-Tanzanite
(To:syu1)

You can try this, i think this fits your requirement more

var params = {

  maxItems: 500 /* NUMBER */,

  nameMask: "<provide entity name here>" /* STRING */,

  type: 'Thing' /* STRING */,

  tags: undefined /* TAGS */

};

// result: INFOTABLE dataShape: RootEntityList

var result = Resources["EntityServices"].GetEntityList(params);

Note that you can use the Type to seach for different entities like Things, Mashups, Users etc

You can find this together with other EntityServices under the Snippets > EntityServices

View solution in original post

5 REPLIES 5
supandey
19-Tanzanite
(To:syu1)

Hi Samuel, you can consider using one of the following search functions available directly under the ThingWorx Composer > System > Resources > SearchFunctions

Hope this helps.

syu1
1-Newbie
(To:supandey)

Hi Sushant, thank you for your reply! Could you, please, be more specific about what Inputs I should enter in order to search the Things I need? I took a look at the Inputs of these three services but just couldn't find 'names' in them. Does that mean I can't search things by name? Or are there other ways to try?

supandey
19-Tanzanite
(To:syu1)

You can try this, i think this fits your requirement more

var params = {

  maxItems: 500 /* NUMBER */,

  nameMask: "<provide entity name here>" /* STRING */,

  type: 'Thing' /* STRING */,

  tags: undefined /* TAGS */

};

// result: INFOTABLE dataShape: RootEntityList

var result = Resources["EntityServices"].GetEntityList(params);

Note that you can use the Type to seach for different entities like Things, Mashups, Users etc

You can find this together with other EntityServices under the Snippets > EntityServices

syu1
1-Newbie
(To:supandey)

Thank you, Sushant. It worked! Thanks a lot for your help!

supandey
19-Tanzanite
(To:syu1)

Glad it worked out

Top Tags