Using the QueryImplementingThings Service
If you are running ThingWorx High Availability Clustering, certain states that used to be an in-memory process (such as property values, Thing state, and connection status) must be shared across the cluster. Therefore, Thing properties are now stored in an in-memory Apache Ignite cache, which does not have significant effect on performance or property ingest.
Improvements have been made to minimize the effects of latency on the queries. The services have been changed so they will only return values of properties that reside on the associated Thing Shape or Thing Template. You can still filter for properties that reside on implementing Things; however, you must use the new GetThingPropertyValues API to return data on implementing Things.
* 
From ThingWorx 9.4.0, a new boolean parameter, isSortFirst, is added to QueryImplementingThings service. The default value for isSortFirst parameter is false and the service continue to work as before. If isSortFirst is set to true, then QueryImplementingThings service will first sort the result set and then apply the limit.
* 
Limit filters and sort only those properties defined on the Thing Shape or Thing Template. Avoid filtering or sorting on properties that reside on implementing Things. You can consider moving properties off of Things and putting them on the implemented Thing Shape or Thing Template.
GetThingPropertyValues
GetThingPropertyValues is a new API that retrieves property values in bulk to limit the number of cache calls required to populate the return data set. Inputs are thingRefrence, which is an infotable of Thing names and type, and dataShapeName, which is a string identifying the Data Shape of the required properties. GetThingPropertyValues returns an infotable of property values for each Thing identified in the thingReference input.
For example, to use this API, you could do the following:
1. Run QueryImplementingThings or QueryImplementingThingsWithData against a Thing Shape or Thing Template.
For best performance, use QueryImplementingThings, which yields Thing names with base fields.
2. Collect all Thing names from QueryImplementingThings.
3. Create a Data Shape that includes all of the different properties from all of the different Things.
4. Call getThingPropertyValues with Thing name collections from step 2 and the Data Shape name from step 3.
The JavaScript for this example is:
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 */
});
Was this helpful?