Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hello,
I am using the Java SDK to invoke service QueryImplementingThingsOptimized
let result = ThingTemplates["LoraDeviceGenericModel"].QueryImplementingThingsOptimized(
{
maxItems: 1000,
});
The corresponding Java code is as follows;
ValueCollection getEntityListParams = new ValueCollection();
getEntityListParams.SetNumberValue("maxItems", BATCH_THINGS);
getEntityListParams.SetNumberValue("offset", offset);
InfoTable queryResult = thingClient.invokeService(ThingTemplates, "LoraDeviceGenericModel", "QueryImplementingThingsOptimized",
getEntityListParams, TIMEOUT_30_000_MS);
But this call could be optimized by using a filter on returned fields;
function entityList(inarray) {
let out = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({ dataShapeName: 'EntityList' });
inarray.forEach(entry => out.AddRow({ name: entry, description: entry }));
return out;
}
let result = ThingTemplates["LoraDeviceGenericModel"].QueryImplementingThingsOptimized(
{
maxItems: 1000,
basicPropertyNames: entityList(['name']),
propertyNames:entityList(['name'])
}
);
My Question is how can I do this via the Java SDK.
ValueCollection getEntityListParams = new ValueCollection();
getEntityListParams.SetNumberValue("maxItems", BATCH_THINGS);
How do I need to populate the ValueCollection to set the basicPropertyNames and propertyNames entries?
Solved! Go to Solution.
try to use follwoing code and appropriate values as parameters. Tried with Thingworx SDK 9.5
ThingTemplate genericThingTemplate = (ThingTemplate) EntityUtilities.findEntity("GenericThing", ThingworxRelationshipTypes.ThingTemplate);
InfoTable data = genericThingTemplate.QueryImplementingThingsOptimized(1000, , nameMask, query, withPermissions, basicPropertyNames, propertyNames, networkName, networkParentNode, networkMaxDepth, offset);
try to use follwoing code and appropriate values as parameters. Tried with Thingworx SDK 9.5
ThingTemplate genericThingTemplate = (ThingTemplate) EntityUtilities.findEntity("GenericThing", ThingworxRelationshipTypes.ThingTemplate);
InfoTable data = genericThingTemplate.QueryImplementingThingsOptimized(1000, , nameMask, query, withPermissions, basicPropertyNames, propertyNames, networkName, networkParentNode, networkMaxDepth, offset);
Hi @AymericR
It appears you may have received a solution to your problem. If so, please mark the response as the Accepted Solution for the benefit of others in the community.
Regards.
--Sharon