hi Chris
thanks for the help, currently this is the script I have:
function getMax(IdCoche,token) {
var fl ='https://services3.arcgis.com/dha0QtUTrPxlyZDZ/arcgis/rest/services/service_0d42ead0e50e46b48f8e1eb32...';
var field = 'KmFin';
var params = "/query?";
var params = "/query?where=IdCoche='" + IdCoche + "'&f=json";
params = params + 'outStatistics=[{"statisticType":"MAX","onStatisticField":"' + field + '","outStatisticFieldName":"MAX"}]';
var URL = fl + params;
var xmlhttp = new XMLHttpRequest();
if (token){
URL = URL + "&token=" + token;
}
xmlhttp.open("GET",URL,false);
xmlhttp.send();
if (xmlhttp.status!==200){
return xmlhttp.status;
} else {
var responseJSON=JSON.parse(xmlhttp.responseText)
if (responseJSON.error){
return JSON.stringify(responseJSON.error);
}
else {
if (responseJSON.features[0]){
return JSON.stringify(responseJSON.features[0].attributes.MAX);
}
else{
return "No Features Found";
}
}
}
}
I keep getting the maximum value of the field I specify in var field, but it doesn't filter me, by the IdCar.
the token issue is quite confusing because for it to work you have to enter it in fx in survey, but these are temporary so they can stop working. i think that section is not very well implemented in survey123 connect.
Regards
Javier C. Martinez Prieto