I have a form where I want to apply a restriction to a question within a repeat group (begin repeat). I'm trying to set it so that when 'motivo_encuesta' is answered with 'Monitoreo', the repeat at the tree level is exactly 30. If the answer is different, there should be no restriction on the number of entries. I'm using this formula: if(${motivo_encuesta} = 'Monitoreo', 30, .). However, for some reason, this is generating a circular reference, and I don't understand why, as I've reviewed the entire file.
I hope someone can help me!
Solved! Go to Solution.
You might want to try using a constraint on a count of the repeats instead of the repeat count field. That way you can make that count field relevant only when Monitoreo is selected.
Calculation: count(${fecha_relevo_arbol})
Constraint: ${field}=30
Relevant: ${motivo_encuesta}='Monitoreo'
I am not sure you can. And I would not as changing the repeat count on the fly tends to have issues.
What I do is instead have a field that does count(${somerepeatfield}) and then put a constraint on that. This constraint can then be a formula like you want. It is much more reliable. Note it will let them add one too many then they have to delete that last one. I added a note red warning for this and our users are ok with it.
Hope that helps
Try this instead:
if(${motivo_encuesta} = 'Monitoreo', 30, '')
The dot represents the current field, so your statement was saying, 'for this field, if this other field is Monitoreo, add a repeat count of 30, otherwise use a repeat count of this exact field'.
The formula I provided instead goes, 'for this field, if this other field is Monitoreo, add a repeat count of 30, otherwise don't set a repeat count'.
Hi Jen,
Thank you for the formula you provided; it worked well for the "Monitoreo" option. However, I'm now having an issue when I select a different option from "Monitoreo." The field appears empty, and it won't let me add any records. I also tried using null, but that leaves the field empty as well. How can I make it so that when I select something other than "Monitoreo," I can add as many records as I want without any restriction?
I really appreciate your help!
You might want to try using a constraint on a count of the repeats instead of the repeat count field. That way you can make that count field relevant only when Monitoreo is selected.
Calculation: count(${fecha_relevo_arbol})
Constraint: ${field}=30
Relevant: ${motivo_encuesta}='Monitoreo'
Hi Jen,
Thank you so much for your response. You were very kind, and I truly appreciate you taking the time to review and answer my question.
I am not sure you can. And I would not as changing the repeat count on the fly tends to have issues.
What I do is instead have a field that does count(${somerepeatfield}) and then put a constraint on that. This constraint can then be a formula like you want. It is much more reliable. Note it will let them add one too many then they have to delete that last one. I added a note red warning for this and our users are ok with it.
Hope that helps
Hello Doug,
Thank you for your response.
I was researching the Esri documentation, and as you said, I can't apply a restriction for one condition or another in the repeat count column. So, I followed your advice and created the restriction in another field. I really appreciate you taking the time to look into this case and give me a hand.