Limit number of repeats in survey

1618
4
11-06-2017 09:56 AM
Highlighted
Occasional Contributor III

I feel like I read a post about using limiting the number of repeats in a survey but can seem to find the post (maybe I was just dreaming this). Any thought on limiting the number of repeats based on either count() or a formula?

Tags (2)
1 Solution

Accepted Solutions
Highlighted
Esri Esteemed Contributor

Hi Brent,

On the note option - here's a very simple example (repeatcheck).

Achieving what you're trying to do might be a little difficult- there isn't a notion of 'continue' for a repeat, just a total number of repeats.  That being said, it is possible - you would need to wrap your criteria for the next repeat in an if statement that would provide a 1 if true (next repeat), 0 for false (no more repeats).  Then a calculation in the form sums that question, and the repeat count is 1+ that sum - see the repeatauotfiling file.

4 Replies
Highlighted
Esri Esteemed Contributor

Hi Brent,

This can be done through 2 methods:

1) Repeat_count will specify a set number of repeats to be filled.  Please see Repeats—Survey123 for ArcGIS | ArcGIS

2) As you mention, you can use the count() function to restrict.  This can be done by having a question with a relevant  expression based on exceeding the number of repeats desired; that question should also have a constraint that evaluates to false by default (1 = 2 is an example).

Highlighted
Occasional Contributor III

Hi James, Thanks for your reply. The "repeat_count" met part of my need, but I think the instructions in Repeats—Survey123 for ArcGIS | ArcGIS are incorrect, they seem to indicate that the "repeat_count field" should be populated for the "begin repeat" I think it needs to be populated in the "end repeat".

I was wondering if you could elaborate on the second option, I am also trying to dynamically limit adding a new repeat record if a certain criteria is met. Basically form takes the count of the numbers of trees sampled (each repeat is a tree) and then if the number of total # egg masses counted falls between the top and bottom values pulled from a table I would like the repeats to continue and if the value falls outside either the 'bottom' or 'top' limit I would like to end the repeat. See line 45, my hope was to use the result of this calculation (\${continueRepeat} =  'Continue') in the relevant for the repeat, but I get the following error 'Dependency cycles amongst the xpath expression in relevant/calculate'. I kind understanding what it is telling me here I am just wondering if there is a way around it or if I am trying to do something beyond the capabilities of S123?  Hope this makes sense, let me know if it doesn't.

Here is a screen shot...I'd be happy to share the form with you, but can figure out how to attach it here.

If this doesn't work my work around was to just have a note pop up to let the observer know if they should continue or not. I have this working mostly but I would like it not to pop up until they have completed the current repeat, right know it pops up as a new repeat is opened, any thoughts on how to accomplish this would be appreciated.

Highlighted
Esri Esteemed Contributor

Hi Brent,

On the note option - here's a very simple example (repeatcheck).

Achieving what you're trying to do might be a little difficult- there isn't a notion of 'continue' for a repeat, just a total number of repeats.  That being said, it is possible - you would need to wrap your criteria for the next repeat in an if statement that would provide a 1 if true (next repeat), 0 for false (no more repeats).  Then a calculation in the form sums that question, and the repeat count is 1+ that sum - see the repeatauotfiling file.

Highlighted
Occasional Contributor III

Thanks James, Your solution worked perfectly. I had one kind of quirky issue, if I put calculation in the repeat_count column for the begin_repeat everything works fine but the repeat count and the buttons to navigate between repeats are at the top of the repeat. Ideally I would like the repeat count and the buttons to navigate between repeats at the bottom of the repeated fields similar to when no repeat count is used, just curious why the placement of the navigation button changes when the repeat count is used?