Formula once(count(${FIELD})) no longer working within a Repeat

06-28-2022 05:32 AM
New Contributor II


Using the latest version of Survey123 Connect, the Formula to count repeats (within a question in a repeat) no longer works. The counter now starts at "0" instead of "1". Every time a new record within the repeat is added it is one behind the expected value e.g. the string output for Unique Fish ID ${ticketNumberDisplay} ends with _0 instead of an expected  _1


The formula in question is 



Originally found the working solution here via a blog

But also via a solution proposed by @JamesTedrick here 

Similar to question answered by @Anonymous User here


Thanks for any help.

Kind Regards, Pat

Tags (3)
1 Reply
MVP Honored Contributor

Yes this was a trick I posted about and used in many forms but it broke.  I switched to using position(..) or if you have multiple repeats position(${repeatname}).  

Note just like once(count()) it is not perfect.  Mainly if a user adds 5 repeats, then goes back to say repeat 2 and deletes it, then adds a new point, you will now have two number 5s.  This assumes you used once.  If you do not use once then if you scroll through the repeats it may or may not update.  You can use the new calculation modes and get them to all update but then the users would have to scroll through all of them.  Even the new always calc setting does not seem to fire unless the user views each repeat.

Looking at what you posted once(count(${FIELD})) + 1 may do it also?  Same issue though using once.  If they go back and delete it causes a mess.  We trained our crews to not go back through and delete but instead just changes the value.

Hope that helps.  It was as good as I could get it.