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

Information about 'GetEntityList' service

amittal-3
14-Alexandrite

Information about 'GetEntityList' service

Hello,

I m trying to use the 'GetEntityList' service in Thingworx which can be found in 'EntityServices' resource. This service has couple of parameters as below:

// result: INFOTABLE dataShape: "RootEntityList"
var result =  Resources["EntityServices"].GetEntityList({
	maxItems: undefined /* NUMBER */,
	nameMask: "PART" /* STRING */,
	type: "Thing" /* STRING */,
	tags: "CMU_MT_IOTServer2.0:AUTO" /* TAGS */
});

I am not able to understand about 'nameMask'. How is this parameter used? Does it take Reg-Ex as input or does it work on 'contains' mechanism? Kindly share some information/samples/examples on how to use this parameter.

Thanks in advance.

-Aditya Mittal

ACCEPTED SOLUTION

Accepted Solutions
khayes1
15-Moonstone
(To:amittal-3)

Hi yes it is like reg-ex, so you could use filters such as:

 

"*PART*"   which would return anything that contains 'PART' in the name

or

"PART*"   which would return anything that begins with 'PART' in the name

or

"*PART"   which would return anything that ends with 'PART' in the name

 

so to get all Thing entities with 'PART' somewhere in the name you can use

var params = {
maxItems: undefined /* NUMBER */,
nameMask: "*PART*" /* STRING */,
type: "Thing" /* STRING */,
tags: "myTag" /* TAGS  if required*/
};

// result: INFOTABLE dataShape: RootEntityList
var result = Resources["EntityServices"].GetEntityList(params);

 

View solution in original post

3 REPLIES 3
khayes1
15-Moonstone
(To:amittal-3)

Hi yes it is like reg-ex, so you could use filters such as:

 

"*PART*"   which would return anything that contains 'PART' in the name

or

"PART*"   which would return anything that begins with 'PART' in the name

or

"*PART"   which would return anything that ends with 'PART' in the name

 

so to get all Thing entities with 'PART' somewhere in the name you can use

var params = {
maxItems: undefined /* NUMBER */,
nameMask: "*PART*" /* STRING */,
type: "Thing" /* STRING */,
tags: "myTag" /* TAGS  if required*/
};

// result: INFOTABLE dataShape: RootEntityList
var result = Resources["EntityServices"].GetEntityList(params);

 

Hello,

 

Just to epand on @khayes1 answer:

  1. You can also use "?", which stands for a single character (analog of "." in regex)
  2. It looks like you can also use regex character classes and quantifiers, e.g. "Device-[0-9]{4}" to find "Device-0001", etc.

/ Constantine

amittal-3
14-Alexandrite
(To:Constantine)

Thanks Guys for the quick response

Regards

Aditya

Announcements


Top Tags