Skip to main content
1-Visitor
July 25, 2019
Solved

Information about 'GetEntityList' service

  • July 25, 2019
  • 3 replies
  • 2671 views

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

Best answer by khayes1

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);

 

3 replies

khayes11-VisitorAnswer
1-Visitor
July 25, 2019

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);

 

18-Opal
July 25, 2019

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-31-VisitorAuthor
1-Visitor
July 25, 2019

Thanks Guys for the quick response

Regards

Aditya