Hi,
I'm trying to set up a simple constraint for a range type question in S123 Connect (v3.16.110).
The range question relates to a percentage of objective progress between 0-100, with the field name ${objective1_progress}. This has been set in the 'parameters' column as 'start=0 end=100 step=10'. It is being populated from an integer field in a hosted feature layer using an encoded URL in Field Maps, i.e.:
var url = 'arcgis-survey123://?itemID=...';
var obj1_prog = $feature["objective1_progress"];
url += '&field:objective1_progress=' + UrlEncode(obj1_prog);
return url;
Unlike text question types that are automatically populated by the encoded URL, the value for the range type question is only populated if I set the default column as the field name, i.e. ${objective1_progress}. Not sure if the integer values in my URL are being treated as a string and setting the default somehow circumvents this.
This resolves the issue of populating the range type question. However, I need to apply a constraint where the minimum must be equal to or greater than the existing objective progress and less than or equal to 100. This is to stop users from accidentally decreasing the objective progress, when it should only increase. I have tried the following expression:
.>=${objective1_progress} and .<=100
I have also tried creating separate integer and range question types to store the value (with null fieldType), then used that field in the constraint, i.e.:
.>=${obj1_prog_int} and .<=100
.>=${obj1_prog_rng} and .<=100
In all cases, I am able to decrease the objective progress and submit the form without the constraint evaluating to False and preventing submission.
What am I doing wrong?