Revert in Epl

How to use revert and fromDate in find measurement query in epl apps?
I want to get the latest measurement for the current day of particular type.

Hello Vaibhavi,
Below find the sample Code snippet

FindMeasurement request := new FindMeasurement;
request.reqId := reqId;
request.params.add("fromDate", (currentTime - 86400.0).toString());
request.params.add("toDate", currentTime.toString());

Divya K

1 Like

I am not sure why, but this snippet isn’t working.

@vaibhavi_ghumare ,
Can you please mention if you getting any errors or what is the behavior,
In case of executing range queries between an upper and lower boundary, for example, querying using dateFromdateTo , the oldest registered measurements are returned first. It is possible to change the order using the query parameter revert=true .
Below is the full code snippet which is working

monitor MySampleMonitor {
	action onload() {
			integer reqId := integer.getUnique();
				FindMeasurement request := new FindMeasurement;
				request.reqId := reqId;
				request.params.add("fromDate", "1701864437");//date is in epoch format
				request.params.add("toDate", "1701950837");
				on all FindMeasurementResponse(reqId=reqId) as resp
				and not FindMeasurementResponseAck(reqId=reqId) 
					log "Received measurements " + resp.toString() at INFO;
				on FindMeasurementResponseAck(reqId=reqId) as requestCompleted
					log "Received all measurements(s) for request " + requestCompleted.reqId.toString() at INFO;
				send request to FindMeasurement.SEND_CHANNEL;
1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.