Select to view content in your preferred language

Constraints on empty fields in repeat

206
1
05-22-2024 12:57 PM
DouglasKnabe
New Contributor III

I have a survey that is basically just repeat. Within the repeat there are entries required while out in the field, and others that can only be entered upon return to the office. The users must be able to cycle through the repeats while leaving the office entries blank, but I need to set it up so they cannot submit the survey until those fields have been complete.

I was able to do a workaround where I calculate a 1 or 0 for each of these "required in the office" fields, then calculate if each one is all complete, with a constraint on THAT calculation. This is a rather messy way to do it and is alot of extra fields.

 Is it possible to use a constraint directly on the original field that requires the field to be non-empty and will fire upon attempted submission? Thus far it doesn't seem to want to work, I'm assuming because it's empty. I've tried string-length(.)>0, string-length(.)!=0, and .!=''. The test case is a text field.

0 Kudos
1 Reply
abureaux
MVP Regular Contributor

The required column accepts logic statements. I regularly set these up for scenarios like you described.

In my case, I have two primary calculates that every one of these "office only" questions gets:

abureaux_0-1716490900759.png

These are linked to a single select:

abureaux_1-1716490972237.png

And those calculates swaps the questions from "note required":

abureaux_2-1716491018267.png 

To "required":

abureaux_4-1716491039739.png

I use the black asterisk as a visual reminder that those question will be required at some point.

0 Kudos