QueryImplementingThings
Description
The QueryImplementingThings service queries and retrieves information about Things that implement specific Thing Shapes or Thing Templates in ThingWorx. It allows you to filter and sort the results based on various criteria, such as property values, tags, and queries.
Input
None.
Output
An infotable type providing the result of the query with the table of implemented Things.
Example
var result = ThingShapes["testThingShapeOneForQITService<>626037"].QueryImplementingThings({ 
maxItems: undefined /* NUMBER */,
nameMask: undefined /* STRING */,
query: undefined /* QUERY */,
tags: undefined /* TAGS */
});

var resultQIT = result;
var params = {
infoTableName : "InfoTable",
dataShapeName : "ThingRefDataShape"
};

// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(ThingRefDataShape)
result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
var thingRef = result;
for(var x=0 ; x<resultQIT.length ; x++){
var thingName = resultQIT[x].name;
var newEntry = new Object();
newEntry.name = thingName; // STRING
newEntry.type = "Thing"; // STRING
thingRef.AddRow(newEntry);
}

// result: INFOTABLE dataShape: "RootEntityList"
result = Resources["EntityServices"].GetThingPropertyValues({
thingReferences: thingRef /* INFOTABLE */,
dataShapeName: "QITDataShape<>392587" /* DATASHAPENAME */
});
QueryImplementingThingsV2
Description
The QueryImplementingThingsV2 service queries and retrieves information about Things that implement specific Thing Shapes or Thing Templates in ThingWorx. It allows you to filter and sort the results based on various criteria, such as property values, tags, and queries.
Input
Parameter Name
Description
Base Type
maxItems
Maximum number of items to return in the result set. The default value is 500. This parameter is applied after all other filters are applied.
NUMBER
tags
The model tags associated with the source of this entry.
TAGS
nameMask
The name pattern for the entities that implement the Thing Template or Thing Shape.
STRING
query
The query criteria used to filter data. Filters can only be written for the effective properties of the Thing Template or Thing Shape on which the service is run. For more information , see Query Parameter for Query Services.
QUERY
isSortFirst
If set to true, Things will be sorted first.
BOOLEAN
Output
Parameter Name
Description
Base Type
result
An infotable type providing the result of the query with the table of implemented Things.
INFOTABLE
Example
var result = ThingShapes["testThingShapeOneForQITService<>626037"].QueryImplementingThingsV2({ 
maxItems: undefined /* NUMBER */,
nameMask: undefined /* STRING */,
query: undefined /* QUERY */,
tags: undefined /* TAGS */
});

var resultQIT = result;
var params = {
infoTableName : "InfoTable",
dataShapeName : "ThingRefDataShape"
};

// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(ThingRefDataShape)
result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
var thingRef = result;
for(var x=0 ; x<resultQIT.length ; x++){ var thingName = resultQIT[x].name;
var newEntry = new Object();
newEntry.name = thingName; // STRING
newEntry.type = "Thing"; // STRING
thingRef.AddRow(newEntry);
}

// result: INFOTABLE dataShape: "RootEntityList"
result = Resources["EntityServices"].GetThingPropertyValues({
thingReferences: thingRef /* INFOTABLE */,
dataShapeName: "QITDataShape<>392587" /* DATASHAPENAME */
});
Was this helpful?