Is there a calculation that will return the index or position of the current repeat set? This would be useful to pulldata and populate the default answers for each of the repeat questions based on the position in the repeat index.
It would be nice if ESRI were to provide the autoincrementing option/solution with a caveat to caution surveys with multiple users.
I'm having the same problem..
Has anyone got this to work in a web form? Seems to work well in the app but it doesn't work in the webform
Hi James Tedrick,
Did the indexed-repeat functionality ever make it in? I'm assuming no because I'm trying to use it and I'm getting an error (unless I'm doing something wrong).
If not, any new developments on how to systematically pull out the data captured in repeats and reference the values elsewhere in the form?
Thank you for your help!
(and help with literally everything else I've done in S123!)
-Dave
Good solution Thomas! Your answer should be pinned to the top so it is made visible.
That works - thanks a lot!
For everyone else here is how to do autonumbering.
In a repeat have a field with a calculate (it can be editable)
Use this formula subbing in any field in the repeat (except itself)
once(count(${RecKey}))
I have never seen once before. Is it documented somewhere? I am surprised esri never mentioned this to anyone.
Thanks again.
Consider including your calculation within a once() function. I have a log within a repeat in survey123, where users can enter a Depth From and a Depth To with comments on that depth range; users can add a repeat to have a series of From/To with notes. Outside of the repeat (hidden) I have a calculation to determine the max "Depth To" recorded, and and in the calculation field of my Depth From I have this max Depth To within the once function as
once(max(${Depth_To}))
Which calculates it only once per repeat (upon creation of the repeat), so that when I go cycle back through repeats the value is maintained.
Used the same to generate a start/stop watch to calculate standing time whilst on site. I used a single option likert "Stop" button as: {StandStop}, and a dateTime function relevant to: ${StandStop} = 'Stop' with the calculation: once(if(${StandStop} = 'Stop',now(),'')).
Well after getting this out to the field we found an issue. If a user goes back in a repeat it will recal as soon as they change repeat records - which updates the field to the current total vs what it was at the time.
So if they are on Repeat #2 then hit back to Repeat #1 it automatically changes the calc field from 1 to 2. It also then wipes data from a relevant we have based on that field.
So as long as they just go forward it works but be careful using this!
Thanks
Hi Doug,
This will work unless you also are using default values in the repeat and a repeat_count - there's an issue where the defaults are not applied in that scenario.
After some testing I got this to work for me.
So if my field is say Point_No and I have another filed called RecKey in the repeat
then I add this to the Calculation of Point_No
count(${RecKey})
Works great.
Make sure to pick another field in the repeat. Any will do just not itself since that throws an error. So count(${Point_No}) does not work for some reason.
Will this cause any issues?
Hope it helps.
Any update on this? Getting the repeat number would be very helpful. Thanks
Hi Luciano,
Both join and indexed-repeat are in the list of functions we plan to implement for XLSForm compatibility. Aside from requesting it here, we use the ideas.arcgis.com section of GeoNet to track user requests; enhancement requests can also arise out of technical support incidents.
Hi James!
How about join() and/or a indexed-repeat() functions to access data inside the repeat group.... It seems to me that these functions are not yet supported in Survey123.
Is there a formal way to propose an enhancement?
Thanks in advance,
Luciano
Understood thanks for clearing up the confusion on my end.
Cheers.
Hi Max,
Currently, the position() function has not yet been implemented - that's why I logged it to an enhancement request, for support of this functionality.
James I do appreciate your assistance through this, however I do still have some unanswered questions that may determine if I am able to use Survey123 at this time:
Is there any known method to reference the index of the repeat group/ repeat group counter at this time? It seems that none of the position(..) operators that I called were able to execute in Survey123 even though my work in other ODK collect/XLSform converters.
"ReferenceError: position is not defined in expression: position(..)"
The end goal I am trying to accomplish would be to dynamically reference external data within a repeat group of a varying number of iterations. Such that the form could be pre-populated with existing data.
Thanks,
Max
Thanks James,
Just FYI it does note that the position() function does not work....Open Data Kit » Binding , which I believe implies that the function must be called on some XPath expression? Such as '..', ie position(..)
"Return the XML position() value of this node in a filtered XPath expression. Note that position() does NOT work."
At them moment I am still trying to find a workaround, and will post if anything pans out. Please let me know if you have any other suggestions.
Have you heard of any success using the position() function in an XLSform w/survey123 ?
Thanks for the enhancement request. There ar a couple of different ways this has been proposed before -
1) having an auto-incrementing number in the repeat
2) The XLSForm spec has a function called position() that might accomplish what you're describing
I've added this post to the enhancement issues of these two features.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.