Is there a method to calculate a sequential integer field for the number of repeats, more specifically for a photo number. I want to populate a field as I add photo repeats, so that I have photo #1, photo #2, photo #3, etc...i was doing this using a count calculation, but have found that if i go back to a previous record before i submit the survey, the photo # value gets repopulated with the total (ie if i have 5 photo repeats all the photo #s get recalculated to "5", rather than 1, 2, 3, 4, 5.
Thanks
Solved! Go to Solution.
Add a once() around your count then it will not do that. You can also use once(position(..)) but I have seen some bugs with it.
But note if a user goes back a few repeats and deletes a repeat then adds a new one you will get a dup. No real way around this. I personally gave up and instead number them all later when I export to to the file system in Python. Way more reliable.
Also we have had users name the site wrong at the start and then we fix it in QA. But at that point all the photo names are then wrong. Also had issues with users adding dup named photos.
It sounds great in theory if it all goes perfect but it never does.
Hope that helps
Add a once() around your count then it will not do that. You can also use once(position(..)) but I have seen some bugs with it.
But note if a user goes back a few repeats and deletes a repeat then adds a new one you will get a dup. No real way around this. I personally gave up and instead number them all later when I export to to the file system in Python. Way more reliable.
Also we have had users name the site wrong at the start and then we fix it in QA. But at that point all the photo names are then wrong. Also had issues with users adding dup named photos.
It sounds great in theory if it all goes perfect but it never does.
Hope that helps
I use a calculate with index(..) position(..) in my repeats. Then I use that for calculating image #. Essentially, it indexes your repeat starting at 1.
EDIT: Long week...
I do not see index() listed in the functions and when I tested it the form says no such function?
Position (..) does what he was talking about. That’s pretty close to what I want. The order still gets a little out of whack if one of the repeats gets deleted before submitting, but all in all is pretty close to what I need and doesn’t have the issue of the numbers getting recalced if I browse through the repeats. Thanks all.
You may still need to wrap it in a once() as I think it has got me before so I would test it.
Two things.
For your auto numbering, do you just need it at the Feature Report level? In that case, have you considered using MS Word's quick parts? You can get auto numbering that way. I use it a lot for photos.
And just for the sake of clarity in case someone else stumbles across this in the future, this is the format for position(..)
EDITED because it's been a long week...
1. no it needs to be passed to the record in the feature layer primarily for map labeling purposes.
2. index(..) throws an error for me in connect. i've seen a couple of folks reference this but there is no index(..) in esri's survey123 formula documentation. however, position(..) does pretty much what i need and is the same concept as indexing the record, wrapped in once() to ensure there are no duplicates in case one of the repeats gets deleted from the form before it is submitted.
thanks
1) Darn...
2) It's been a long week. Ya, It's position(..)
great stuff.
position(..) worked a treat. thx