Hi All,
It might sound trivial (and I have been looking at other samples on the community group), but it seems to be a challenge to get a single LATEST (no date filtering) value for the StatusData elements. I have tried to use the resultsLimit and sort options, but I get the error:
"Failed:Only sorting by date in ascending order is supported when interpolating."
Has anyone been successful in getting the latest / last value for a measurement metric (using the StatusData) on demand via the sdk?
My failed attempt:
var deviceId = 'b1'
api.call("Get", {
"typeName": "StatusData",
"resultsLimit": 1,
"search": {
"deviceSearch": { id: deviceId },
"diagnosticSearch": {
"id": "DiagnosticEngineOnTimeId"
}
},
"sort": {
"sortBy": "date",
"sortDirection": "desc",
"offset": null,
"lastId": null
},
}, function(result) {
console.log("Done: ", result);
}, function(e) {
console.error("Failed:", e);
});