Select to view content in your preferred language

I tried using a formula in the repeat count column, and it generates circular references. How I can fix it?

565
6
Jump to solution
09-13-2024 03:18 PM
AFSIG
by
Emerging Contributor

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!

AFSIG_0-1726265749117.png

 

0 Kudos
2 Solutions

Accepted Solutions
JenniferAcunto
Esri Regular Contributor

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'

- Jen

View solution in original post

DougBrowning
MVP Esteemed Contributor

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

View solution in original post

6 Replies
JenniferAcunto
Esri Regular Contributor

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'.

 

- Jen
AFSIG
by
Emerging Contributor

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!

0 Kudos
JenniferAcunto
Esri Regular Contributor

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'

- Jen
AFSIG
by
Emerging Contributor

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.

0 Kudos
DougBrowning
MVP Esteemed Contributor

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

AFSIG
by
Emerging Contributor

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.

0 Kudos