Help with indexed-repeat error on double repeat

Hi,

I have the following code which produces an error suggesting the use of a
indexed-repeat. Does anyone have any suggestion on how to use
indexed-repeat() to make this code work.

Thanks,
James

Help.xlsx (50.5 KB)

In general, you cannot use ${fieldname} to reference any field within a
repeat group.

E.g., ${segment_name} does not work.

This is confusing, because if you create a form with just one copy of the
repeat group, everything is fine.

The problem occurs when you add the 2nd copy of the repeat.

The ${segment_name} then expands into a vector of values from the first and
second repeat.

E.g., [ value_from_first_repeat, value_from_second_repeat ]

but all your formulas are expecting a value, and not a vector.

The solution is to use relative references ("../segment_name") and think
about XPath expressions.

See https://opendatakit.org/help/form-design/#xpath_expressions

··· On Wed, Mar 15, 2017 at 8:42 AM, James wrote:

Hi,

I have the following code which produces an error suggesting the use of a
indexed-repeat. Does anyone have any suggestion on how to use
indexed-repeat() to make this code work.

Thanks,
James

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

James

Provide the column headings in the attached file

Regards

··· On Wednesday, March 15, 2017 at 5:42:34 PM UTC+2, James wrote: > > Hi, > > I have the following code which produces an error suggesting the use of a > indexed-repeat. Does anyone have any suggestion on how to use > indexed-repeat() to make this code work. > > Thanks, > James > > >