Survey123 functionality: calculate position in repeat group?

11288
24
04-07-2017 02:55 PM
MaxMarno
New Contributor III

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.

0 Kudos
24 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Max,

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.

MaxMarno
New Contributor III

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,

Max

0 Kudos
MaxMarno
New Contributor III

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

0 Kudos
JamesTedrick
Esri Esteemed Contributor

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.

MaxMarno
New Contributor III

Understood thanks for clearing up the confusion on my end.

Cheers.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Any update on this?  Getting the repeat number would be very helpful.  Thanks

0 Kudos
LucianoCampagnolo1
New Contributor II

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

JamesTedrick
Esri Esteemed Contributor

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.

DaveThompson101
New Contributor III

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

0 Kudos