Going through all existing repeats before submitting survey

643
3
Jump to solution
07-13-2021 02:05 AM
IniobongBenson
New Contributor II

I have a survey where I have enabled inbox to pull in existing records and the records use repeats. For example, one building may have multiple cameras on which an inspection is to be carried out.

The form shows that for a particular building there could be 1 of 3 cameras when a particular building is open from the inbox list, and there are relevant questions that must be answered before the form can be summitted, however, an inspector that submit the form even without going through the remaining 2 cameras in the building. How can I solve this?

IniobongBenson_0-1626165862138.png

 

I've been able to create a field that stores the count of cameras in each building and show it in a note using the count(${repeat_field}) but this is not enough. Is there a way to force the inspector to actually go through each repeat and answer at least the relevant question?

Thanks

IniobongBenson_1-1626166952909.gif

Using a join like this on the image above would probably make it work but I don't know how to implement this.

https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-repeats/ba-p/89804...

0 Kudos
1 Solution

Accepted Solutions
Philip-Wilson
Esri Notable Contributor

Hi @IniobongBenson,

Yes, you can do this using a constraint in the main layer referencing values from the repeats. Add a count in a hidden field that will check each repeat and either count a question or do a string-length > 0, to ensure there is an answer in that question and returns a 1.

Then sum or count the 1's, and if they match the number of repeats, the constraint will be met, if they do not match, it means one of the repeats is not answered. This will cause an error and the form can not be submitted.

Please refer to https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm for supported formulas and functions, including the newly added functions for position and indexed-repeat, which you may find useful to query each repeat for specific values.

Regards,

Phil.

View solution in original post

3 Replies
Philip-Wilson
Esri Notable Contributor

Hi @IniobongBenson,

Yes, you can do this using a constraint in the main layer referencing values from the repeats. Add a count in a hidden field that will check each repeat and either count a question or do a string-length > 0, to ensure there is an answer in that question and returns a 1.

Then sum or count the 1's, and if they match the number of repeats, the constraint will be met, if they do not match, it means one of the repeats is not answered. This will cause an error and the form can not be submitted.

Please refer to https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm for supported formulas and functions, including the newly added functions for position and indexed-repeat, which you may find useful to query each repeat for specific values.

Regards,

Phil.

ErikHerbergMETC
New Contributor II

Hey @Philip-Wilson!

I decided to try this out as a way to make sure a user actually fills in all repeats defined by repeat_count. It works when submitting a new form via Collect, but it fails when a form is saved in Drafts and then resumed. My XLSForm is attached. Did I code it wrong? Is this a bug or an intended feature? I see in this post that calculations don't retrigger when resuming from Drafts by design, so is that the issue?

Is there a solution to make sure all predefined repeats are completed that also works when resumed from Drafts? I've tried a lot of things and none of them seemed to work successfully. For example, I also tried to make one question required for all repeats, but that also failed when resuming from Draft (I just made a post about that here).

Thanks in advance for any help!

0 Kudos
Philip-Wilson
Esri Notable Contributor

Hi @ErikHerbergMETC ,

The issue you are encountering with repeat_count and saving to Drafts is a known issue and is logged as BUG-000127011. Unfortunately the underlying problem has yet to be resolved and won't be fixed in upcoming release, but something we are working on.

The only workaround in the meantime is not to use repeat_count if you need to save to Drafts, otherwise values in the repeats can not be edited or added once you open the survey from Drafts again.

Regards,

Phil.