Repeat values jumps between different repeats

780
6
06-17-2021 08:38 AM
Marcus
by
New Contributor II

Hi,

In our survey we have the problem for our fieldworkers that values entered in one repeat can jump and insert themself in an other repeat in the same question.

When that happens a required field alert for a field in the repeat, that is already answered will say that it needs an answer and you can't change the alert even if you answer a new value, thus making the survey not possible to send in.

The survey is quite complex, but I send a very simple survey how the basic structure of the survey is built. The problem does not happen every time and is hard to systematically isolate.

Sincere regards,
Marcus

Tags (2)
0 Kudos
6 Replies
DougBrowning
MVP Esteemed Contributor

Not sure why you are using position(..) and counting numbers.  Counting is the "old" way and I would use position.  I would not name the field position though.

If you do you count you usually need to but a once() around it or it will be recalcing on you all the time.  Like when a user scrolls back in a repeat it will fall apart.  Also not sure why there is a required on the counter.

Hope that helps

0 Kudos
Marcus
by
New Contributor II

Thank you very much Doug! It makes it more clear on what could be the problem.

It's primarily only the count method that is used currently while we are also testing the position method if that makes any change for the better. However this is just a small demo for the survey we use, we are a governmental branch and the survey have maybe 200-300 fields.


The once suggestion was useful, we have many calculate fields in the repeat and our surveyors regularly goes backs and edits data. Should you change all calculation fields in repeats to include also once() ?




0 Kudos
DougBrowning
MVP Esteemed Contributor

That tonally depends on what the calc is.  If they change a value then you may want a recal.  Counting you would not.

I have been using position in forms that big without issue.  (I am also a govt agency so feel free to write me.)  One trick is in nest repeats you cannot use .. you have to give it the repeat name you want.  position(${repeatname}).

If you just want a unique key uuid() works great.  I personally always use meaningful ids so I can recreate them if they get messed up (like if you delete a parent the child goes null).

Hope that helps

0 Kudos
Marcus
by
New Contributor II

Thank you, that is very generous of you!

Yes hmm, do not still really know what is causing the jumping repeats . I think we have to use relevant and not once() in repeats due to that we have a question outside the repeat that dynamically set the repeat_count, and this repeat_count can change during the survey.

So is it that if you have a nested repeat you have to give the name of inside repeat as an argument to position for it to work?

Would you by perhaps have the possibility to look if you find something with a quick eye, by sending it over email perhaps?

Thank you,
Marcus

0 Kudos
DougBrowning
MVP Esteemed Contributor

Sure you can PM me the survey.  If it is a nested repeat I have varied the repeat count before but it can be dangerous when repeat gets smaller data is gone.  Having a relevant on a calculate is weird and if that feeds the repeat count it may get mad getting an empty string for a value.  

Send it along and I can see.

0 Kudos
Marcus
by
New Contributor II

Thank you so much! Will try to send the files with a description.

Aha I thought that you needed to have the relevant (a relevant with a condition is always fulfilled), there to make the calculations update if the surveyors change a a value outside the repeat, that affect a value inside of the repeat?

0 Kudos