I have 2 fields one called email and the other phone. I want to make it so that either one of them have to be filled in for the survey to be sent. How do I set the required and constraint fields? Any help is appreciated
For these it always ends up in a dependency cycle. So I use a 3rd field like this.
Someone may have another idea. Hope it helps.
Doug Brwoing with the WIN! Thank you that solved it!
How did you solve this. Which one is set to required?
Neither is set to required. You instead set the constraint on field 3 to !=''. This will fire if both are blank but not if either one has a value.
Has anyone tried this solution recently? I had built a survey in Survey123 Connect a few months back implementing this solution, but it does not appear to work anymore. I tried setting up similar constraints on multiple fields, but they survey goes through without any issues.
I like Doug's solution, but we solved this by creating a select one question (${contact}) that asks the user "how do you wish to be contacted" with (text message, email, phone) as options. Then you make the email and phone questions (both set to required) visible/hidden with a relevant expression. selected(${contact},'email') on the email question or selected(${contact},'phone') or selected(${contact},'text_message'). if the question is relevant, it will be required.
Sorry to stir up an old post but is there any way to do this with the current web creator or is this functionality reserved to Survey123 Connect?
Here we are years later and you are correct. Doug's solution throws the constraint in the Survey123 Connect app, but no constraint is thrown when I complete the published survey in my browser.
I have another way to go about this. I will provide screen shots of my actual survey, so I apologize for the funny field names.
The first two rows are the questions I require one of two. I make the second relevant == 'no' if the first is answered. Third row, a calculate question checks if either of my first two questions are blank. Fifth row, combines all of the checks into a calculation that determines how many of the five question pairs was entered. Last is a read-only yes/no questions which is propagated by a calculation that looks at the concatenation previously created. In this case 1 or 0. I want all 1 (11111) for all five question pair being answered. The cell under required can be ignored in this example - It's related to something else going on in the XLS form. If the last question is not 'yes' it holds up the user, and they are unable to select 'yes' themselves. Their only option is to fill in sub_size or sub_class.In the example @DougBrowning gave (tip of my cap, your idea inspired mine... go packers) my users would have to submit to realize they missed a data point. My survey is very large with 11 repeats. They input about 3,000 data points before submission. Users would have to go back through their repeats to find empty fields.
@cquick2 For a browser I would try adding a space . = "" and also the actual field name ${field3} != "". If no then next try string-length > 0 to check. I have seen issues in the browser with all of these.
Maybe even try moving the coalesce calc to its own field then add a constraint on that field to field 3. It could be that it is checking in the wrong order.
Note you may see issues with a calc in a read only - yes field. I have seen where 123 assumes the value cannot change since its read only. I would go back and remove values and see if it still works. Also test coming back from a draft and back from sent box.
Typically if the check is inside the repeat then it should fire before moving to the next one. Hard to tell your use case. Using emojis for instant checks may help also https://community.esri.com/t5/arcgis-survey123-documents/how-to-simulate-instant-data-checking-using-emojis/ta-p/916725
Hi Doug,
This fix seems to be appropriate for something I'm trying to do as well - however I have FIVE fields where I want at least one with a value. I tried to use your fix but the five fields in the coalesce function but Collect kicked off that I have five fields instead of two... Any thoughts on a fix? I thought I could use coalesce for more than two fields....
Cheers! Laura
I should also note that I am working within a repeat - the five fields are in a repeat, and 1/5 needs to be answered per repeat. Cheers, LD
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.