GetThingPropertyValues
Description
GetThingPropertyValues retrieves property values in bulk to limit the number of cache calls needed to populate the return dataset. If the requested property is not on the requested Thing, an empty value is returned.
Inputs
Parameter Name
Description
BaseType
thingReferences
An infotable that consists of a list of Things.
The expected Data Shape for the infotable is EntityReference.
INFOTABLE
dataShapeName
Name of the Data Shape that encapsulates the values of the properties to be returned by the query.
The Data Shape must exist in the ThingWorx model. The Data Shape can be a system entity or a user-defined entity.
DATASHAPENAME
Output
Parameter Name
Description
Base Type
result
Returns an infotable with the values for properties requested in the Data Shape for each Thing requested in the thingReferences input.
The Data Shape of the return infotable will contain the name of the Thing and all properties in the input Data Shape.
INFOTABLE
Example
In this example, three Things, a Data Shape, and a stream are defined with different properties.
Entity
Properties
Thing1
Property1
Thing2
Property1, Property2
Thing3
Property1, Property2, Property3
TestStream
Property1, Property2, Property3
TestDatashape
Property1, Property3, Property4
The following is an example code.
// Create a thingRef Infotable with the datashape EntityReference
var thingRefInfoTableParams = {
infoTableName : "InfoTable",
dataShapeName : "EntityReference"
};
var thingRef = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(thingRefInfoTableParams);

// populate thingRef InfoTable
var thing1Entry = new Object();
thing1Entry.name = "Thing1"; // STRING
thing1Entry.type = "Thing"; // STRING

var thing2Entry = new Object();
thing2Entry.name = "Thing2"; // STRING
thing2Entry.type = "Thing"; // STRING

var thing3Entry = new Object();
thing3Entry.name = "Thing3"; // STRING
thing3Entry.type = "Thing"; // STRING

var streamEntry = new Object();
streamEntry.name = "TestStream"; // STRING
streamEntry.type = "Thing"; // STRING

thingRef.AddRow(thing1Entry);
thingRef.AddRow(thing2Entry);
thingRef.AddRow(thing3Entry);
thingRef.AddRow(streamEntry);

// result: INFOTABLE dataShape: "RootEntityList"
result = Resources["EntityServices"].GetThingPropertyValues({
thingReferences: thingRef /* INFOTABLE */,
dataShapeName: "TestDatashape" /* DATASHAPENAME */
});
The following table shows the output for the above query. Property4 is empty since none of the requested Things had Property4 defined. Property3 is empty for Thing1 and Thing2 since they did not have Property3 defined.
thingName
Property1
Property3
Property4
Thing1
11
Thing2
21
Thing3
31
33
TestStream
S1
S3
Was this helpful?