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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Optimize way to write services

SonaliPatro
7-Bedrock

Optimize way to write services

As the querypropertyhistory contains a lot of historical data, how can i efficiently get data for a particular time interval and write an optimized code operation.

2 REPLIES 2

// dateValue:DATETIME
var dateValue = new Date();

// dateAddDays(dateValue:DATETIME,amount:NUMBER):STRING
var calculatedDateValue = dateAddDays(dateValue, -1);

 
var endDate = new Date()
var params = {
	oldestFirst: undefined /* BOOLEAN */,
	maxItems: undefined /* NUMBER */,
	endDate: dateValue /* DATETIME */,
	query: undefined /* QUERY */,
	startDate: calculatedDateValue /* DATETIME */
};

// result: INFOTABLE dataShape: "undefined"
var result = me.QueryPropertyHistory(params);

Hi Sonali,

If you want to fetch 24 Hrs data you can use above code and if you want interval as Hrs , Minutes, Second you can take it from code snippets in TW.

Thanks & Regards
K Bairagi

Hi @SonaliPatro 

 

Just wondering if you're still trying to solve your issue. If you have found a solution, please post it for the benefit of others in the community or mark an existing response as the Accepted Solution.

 

Thanks,

Vibhuti

Top Tags