cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to get maxItems dynamically to use in SearchThingsByTemplate method

aksharma2911
5-Regular Member

How to get maxItems dynamically to use in SearchThingsByTemplate method

I am using below code to get all things data .

 

var params = { 

maxItems: 700000,
nameMask: undefined,
query: undefined,
thingTemplate: 'tempalteName',
tags: 'tagname'
};


var result = Resources["SearchFunctions"].SearchThingsByTemplate(params);

 

 

Instead of 700000 as hardcoding. is there any function which will give me available thing count which implemented the said thing template.

2 REPLIES 2

Hi @aksharma2911 you could look into using GetImplementingThings() , see the API doc for more

You should look onto services performance, they vary a lot between them, maybe instead of using the total of the specific derived ThingTemplate it's ok with just giving the total of things ( which it's available at no processing power cost ):

 

You have the service:

 

var entityCount = Subsystems["PlatformSubsystem"].GetEntityCount({ type: "Things" });

 

Where you get the total number of things.

Announcements


Top Tags