Select to view content in your preferred language

Calculation in nested repeat not triggering

149
4
Thursday
Neal_t_k
MVP Regular Contributor

I ran into what appears to be a Survey123 web form issue with nested repeats and wanted to share. I haven't seen this exact issues brought forward.  I think I have it solved for my purposes. I am posting to see if anyone else has ran into the issue, has any explanations or alternate solutions

My form structure is:

Main form ->Product repeat->Ingredient repeat

Inside the Ingredient repeat, I have a simple hidden calculated field based on another question in the same repeat ( if (selected(${<field}, 'A'), 'A', 'B')>. The calculation worked correctly in Survey123 Connect and the Field App, but in the web form it behaved inconsistently.

  • All Ingredient records under the first Product calculated correctly.
  • In subsequent Product repeats, the calculated Ingredient record would not recalculate and stayed at the default value.
  • Calculation mode appeared not to have an affect.

Adding a relevant clause to the calculated question seemed to solve some of the issue (string-length(${<field>})>0) as it delays the trigger until there is an answer to the previous question. However, after adding the relevant clause the first record of each subsequent repeat still displayed this issue unless I added a second ingredient and then returned to the first ingredient of the second product, it would then recalculate correctly.

Changing the calculationMode from 'auto' to 'always' appears to have fixed this for my situation. But I believe it has to do with the re-evaluate calculations upon submit, more than fixing the behavior as it replicates the go back to question one trigger, not actually solving the why it didn't trigger on the first ingredient of the 2nd product issue.

Again thought I would share and see if anyone else has thoughts.

 

0 Kudos
4 Replies
f92k
by
Occasional Contributor

Is your survey published using version 3.25? Version 3.25 has an update that affected calculations. See these pots:

  1. Re: Erro 3.25.27 groups in ${modo_form} = 'edit' - Esri Community
  2. Solved: Re: Survey123 Connect Update 3.25 - inputMask subm... - Esri Community
0 Kudos
Neal_t_k
MVP Regular Contributor

Those appear to be different behavior than I am describing.  I am not re editing an existing submission, these are all new records. The behavior appears to be be happening on whether calculation mode is set to auto or always.  Always only appears to be working because of this: 

Neal_t_k_0-1779126041925.png

 

0 Kudos
f92k
by
Occasional Contributor

What version is your form?

0 Kudos
Neal_t_k
MVP Regular Contributor

I publish from connect so it is the latest version.  Just updated on Friday.

0 Kudos