I have a survey in Survey123 Connect. One of the questions asks for a meter reading value. The constraint on this value is that it must be higher than the previously entered readings for that specific meter.
I used the pulldata() function here and it is working properly.
However, there are a select few cases in which the new reading may not be higher than a previous reading.
Is there a way to input some sort of manual override to the constraint? What I'm picturing is that when the constraint error message pops up, there is some sort of option for "override constriant, value entered is correct' or something.
Any ideas are much appreciated!
Solved! Go to Solution.
mm I have had issues with numbers not liking "". (Note . just means the current field. It is just short hand.
Try this.
(${reading} > ${lastreading}) or (string-length(${override}) > 0)
I'm not aware of any overrides to constraints. But, I think you could probably get creative with it. You might be able to keep your question as is, but incorporate an override value into the constraint itself. And then that would open up a new question for you to enter the "correct" value. It would be something like this:
That's a potential workflow that might work. It's the best idea that I have, but it might be overly complicated compared to some other ideas people might have.
You can add a or to your constraint that links to a override field. Something like new > old or override != "" - have the override field relevant if new < old.
I tend to use a note field with a font color red and big font Warning that pops up. Then have a question appear asking why they had to override. Constraint that override field cannot be blank. That way they have a huge warning they are under the old value and must consciously select a reason why. Some crews still skip our huge red warning but that is users for you.
I think this is a good way to go about this. However, when I tried to write out this constraint it seems it's not working. This is what I have. It may be a simple syntax error; I am still new to this. I have seen periods in other constraints before, but I'm not sure what this actually signifies. Any idea whats wrong?
${reading} > ${lastreading} or ${override} != ''
'reading' is the user inputted reading
'lastreading' is the most recent reading on that specific meter
'override' is a field I created for users to input whether or not to manually override the constraint.
However, I am able to send the survey even if the override field is blank and the new reading is less than the old reading, so it's almost as if it isn't reading my constraint at all
mm I have had issues with numbers not liking "". (Note . just means the current field. It is just short hand.
Try this.
(${reading} > ${lastreading}) or (string-length(${override}) > 0)
I think that worked! Thank you so much!
You can use if statements in constraint fields, so if you have questions that indicate when conditions where are lower reading would be acceptable, then use that to build it into the constraint. I am guessing a new meter installed would be one of those: If (selected(${visit},"NewMeter"), Constraint1, Constraint2).