Consistent numbering of repeat items

321
3
07-23-2019 02:59 AM
deleted-user--2hDb5YTmQS1
New Contributor II

Hi,

There are already some threads on how to number repeat items (e. g. How to assign each repeat group within a repeat a number label).

The proposed solution, using the once(count()) combination, seems to do the trick, but it cannot guarantee a consistent numbering of the repeat items. When, in a first instance, I create three items within a repeat (numbers #1, #2, #3) and then delete the first item (#1), the two remaining items still have numbers #2 and #3 (which is okay). Now, when I create another item (actually number #4) it also gets number #3 leaving me with two items that are numbered #3. (Maybe this is what James meant by noting '...that this does not update if a repeat is deleted mid-way through completing the form').

Is there any other way to consistently number all items in a repeat question, taking intp account that items might get deleted?

Thank you very much, best regards,

Jürgen

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

This may have came from my post.  I use it a lot but it never came up! 

Now that I think about it maybe once(max() + 1) would work.  You have given me something to consider here.

0 Kudos
deleted-user--2hDb5YTmQS1
New Contributor II

Hi Doug,

Thank you for your answer. Although this new approach with the max() function seems reasonable, I don't get it working. Did you find out how to do the trick?

Thanks, Jürgen

0 Kudos
DougBrowning
MVP Esteemed Contributor

max only works outside the repeat if I remember right.  So you need a hidden field outside the repeat with max in it.

0 Kudos