Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi,
I would like to get total no of things as count, in which thing name starts with "Test-". As these kind of things in platform are very huge like more or less to 100000 (more than lakhs and those are remote things)., like to know getting count as result directly from api instead of infotable aggregate functions...
Kindly let me know, if any api/service available to get the count directly with out infotable.
Thanks
Gopi
Hi,
As far as I know, there's no such API readily available that fulfills your exact requirement.
I would create a custom service like below combining predefined services SpotlightSearch and getRowCount.
Then you can send POST request to http://host:port/Thingworx/Things/<ThingName>/Services/<ServiceName>
to call the custom thing service.
***************************************************
let params = {
searchExpression: "Test-*" /* STRING */,
types: {"items" : ["Thing"]} /* JSON */,
searchDescriptions: false,
aspects: { "isSystemObject":"false" }
};
let result = Resources["SearchFunctions"].SpotlightSearch(params).getRowCount();
***************************************************
Hi Tony,
Thanks for your response.
If not provided the maxItems to SpotlightSearch(), is it providing all things which are matching.. All these similar things are more than 100000... What is the defaultValue of maxItems, if not provided.
Thanks
Gopi
Hi Gopi,
That's a good question...
I haven't found any detailed info on maxItems in any documentation.
My assumption was if maxItems is not specified, it should return all things that match the SpotlightSearch criteria.
But you can test this by comparing the row number returned 1) when maxItems is specified to a large enough number and 2) when leaving out maxItems
There's a similar input called maxSearchItems.
I found "the default value of maxSearchItems variable is 100000" in an internal page. Please also test this variable as well since you have more than 100000 things in your system.
Thanks,
Tony
Hi Tony,
Thanks for your response.
If not specified maxItems, considering default value... i.e. is 500
Thanks
Gopi
Hi Gopi,
Thank you for letting me know your test result.
The default value for maxItems is 500, noted.
Best,
Tony