Select to view content in your preferred language

once(join()) work differently on the first repeat

1317
11
03-14-2022 01:27 PM
DougBrowning
MVP Esteemed Contributor

When I use once(join)) inside of a repeat the first records works differently.  It adds it right away where all other repeats adds it after the move to the next repeat.  I am trying to get around this using position but I use pages which means it is in a group which means it always returns 0.

First repeat

DougBrowning_0-1647289435934.png

 

Second repeat is the same

DougBrowning_1-1647289466300.png

 

3rd repeat see how the last value is not on the list.

DougBrowning_2-1647289520044.png

 

I maybe got around it by counting a field in another field after the list and then checking that field to adjust my check.  May not make sense but it seems that the order matters.  So if I count a field before that field I do not get the count you are on but if I count it after I do get it.

Thanks

0 Kudos
11 Replies
by Anonymous User
Not applicable

Hi @DougBrowning,

Does this appear to be new or different behavior with the recent 3.14 release, or did you see the same thing before with 3.13?

Are you able to send us this form (updated copy) so we can take a closer look?

Thanks,

Phil.

0 Kudos
DougBrowning
MVP Esteemed Contributor

I think new to 3.14 but not sure.  I had to change the code since 3.14 broke my dups check trick.  I ended up having to code around it by checking if it was the first repeat.  This was actually hard since I had to count a field that was after the constraint field - which took a few hours to track down.

if(${TempCount}=0, 1,${Species}='' or contains(${Species}, "XXXX") or not(contains(${AllPlantsCheck}+",",${Species}+",")))

I will email you the form.  Thanks

0 Kudos
by Anonymous User
Not applicable

Thanks @DougBrowning,

Got your email, we will take a look and get back to you.

Phil.

jrowe19
New Contributor

Hi @DougBrowning and Phil. Was this ever resolved? I am having the same issue. Thank you!

0 Kudos
DougBrowning
MVP Esteemed Contributor

Update to myself.  2 years later and it is still doing it.  I finally found a fix.  If you set your count field that has a calc of 1 to also have a default value of 1 then the repeats calc properly.

JoshB123
Occasional Contributor

@DougBrowning Im trying to create a very similar survey and struggling to understand using Once() in repeats. Would you be happy to share XLS form to help me understand how it works properly?

Josh

0 Kudos
DougBrowning
MVP Esteemed Contributor

DougBrowning_0-1729020169220.png

Just have a field with 1 in it then a second field is once(count())

JoshB123
Occasional Contributor

Thanks, I figured out I wasn't actually needing to use the once() function. I wanted to have a select multiple that populated into repeats but also updated itself when the select multiple list was changed, but regardless of the order they were selected.

Instead I used this: selected-at(${species_choice},position(..)-1)

JoshB123_0-1729073306141.png

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

position can cause looping in your form so watch out for that.  In Connect open your form and then wait a minute or two and see if this symbol pops up in the upper right corner.

DougBrowning_0-1729082246372.png

I had to take position out of all my forms as it would loop to infinity and started to cause slow or crashing forms.  It will seem ok at first, but if that symbol shows up do not ignore it.