Hi, I posed a getCount custom JS function here: https://github.com/IsmaelInRedlands/Survey123-Tricks-of-the-Trade/tree/main
This is what it looks like:
function getCount(featureLayer,token){
var xmlhttp = new XMLHttpRequest();
var url = featureLayer + "/query?f=json&where=1=1&returnCountOnly=true";
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 {
return JSON.stringify(responseJSON.count);
}
}
}
For the feature layer parameter, pass the URL including the layer index. For example:
https://services2.arcgis.com/fJJEXNgxjn0dpNsi/ArcGIS/rest/services/Carriage_Trail/FeatureServer/0
If your layer is shared publicly, you do not need to pass the second parameter. To get the token from the user, use:
pulldata("@property","token")
Starting with the 3.16 release, you can also make use of the pulldata("@layer") function. Check: