Skip to main content
5-Regular Member
April 10, 2018
Question

How to get maxItems dynamically to use in SearchThingsByTemplate method

  • April 10, 2018
  • 2 replies
  • 2062 views

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

5-Regular Member
April 10, 2018

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

1-Visitor
April 11, 2018

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.