Combining indexed-repeat and jr:choice-name?

Hi -

I am trying to use indexed-repeat and jr:choice-name to display the label
for a select_one response that is part of a repeated group. Here is what I
have been trying in calculate:

indexed-repeat(jr:choice-name (${HDFODRKH}, '${HDFODRKH}'),
${HouseholdDiet}, ${HouseholdDietIndex})
but the error message I get says "XPath evaluation: type mismatch
indexed-repeat():first parameter must be XPath field reference"

Do I need to separate into two calculations or is there a way to combine?

Thanks,
M

indexed-repeat() accesses a field in your form.
jr:choice-name() maps a field value back into a choice name.

You have the nesting wrong:

jr:choice-name(
indexed-repeat(${nestedfieldname},${group},${index}),
${nestedfieldname})

··· On Wed, Aug 26, 2015 at 3:18 AM, Meghan Loraditch < meghan.loraditch@gmail.com> wrote:

Hi -

I am trying to use indexed-repeat and jr:choice-name to display the label
for a select_one response that is part of a repeated group. Here is what I
have been trying in calculate:

indexed-repeat(jr:choice-name (${HDFODRKH}, '${HDFODRKH}'),
${HouseholdDiet}, ${HouseholdDietIndex})
but the error message I get says "XPath evaluation: type mismatch
indexed-repeat():first parameter must be XPath field reference"

Do I need to separate into two calculations or is there a way to combine?

Thanks,
M

--

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

I can manage to do this, but i got error, when add second data in reapeted
field
i believe i messup with indexed-repeat and position(..) but dont know how
to fix it
need advise please...

here xls form and pict of the error

https://lh3.googleusercontent.com/-F3AJyWqdVwc/V85_dHaiUtI/AAAAAAAAGrY/30iV5txQikEL6gRRVIqOWVky2vSafev-ACLcB/s1600/screencapture-ee-kobotoolbox-org-x-1473149554559.png

https://lh3.googleusercontent.com/-ambx0c0qXR0/V85-Np7UrBI/AAAAAAAAGrM/2v_pFSizRjAxPL5_ywBy5E_IIPpFoYT-QCLcB/s1600/WhatsApp%2BImage%2B2016-09-06%2Bat%2B15.22.19.jpeg

HK11_v2.xls (32 KB)

··· On Wednesday, August 26, 2015 at 5:18:52 PM UTC+7, Meghan Kershaw wrote: > > Hi - > > I am trying to use indexed-repeat and jr:choice-name to display the label > for a select_one response that is part of a repeated group. Here is what I > have been trying in calculate: > > indexed-repeat(jr:choice-name (${HDFODRKH}, '${HDFODRKH}'), > ${HouseholdDiet}, ${HouseholdDietIndex}) > but the error message I get says "XPath evaluation: type mismatch > indexed-repeat():first parameter must be XPath field reference" > > Do I need to separate into two calculations or is there a way to combine? > > Thanks, > M >

When using repeat groups, see
https://opendatakit.org/help/form-design/#xpath_expressions

··· On Tue, Sep 6, 2016 at 1:34 AM, Budi Yunior wrote:

I can manage to do this, but i got error, when add second data in reapeted
field
i believe i messup with indexed-repeat and position(..) but dont know how
to fix it
need advise please...

here xls form and pict of the error

https://lh3.googleusercontent.com/-F3AJyWqdVwc/V85_dHaiUtI/AAAAAAAAGrY/30iV5txQikEL6gRRVIqOWVky2vSafev-ACLcB/s1600/screencapture-ee-kobotoolbox-org-x-1473149554559.png

https://lh3.googleusercontent.com/-ambx0c0qXR0/V85-Np7UrBI/AAAAAAAAGrM/2v_pFSizRjAxPL5_ywBy5E_IIPpFoYT-QCLcB/s1600/WhatsApp%2BImage%2B2016-09-06%2Bat%2B15.22.19.jpeg

On Wednesday, August 26, 2015 at 5:18:52 PM UTC+7, Meghan Kershaw wrote:

Hi -

I am trying to use indexed-repeat and jr:choice-name to display the
label for a select_one response that is part of a repeated group. Here is
what I have been trying in calculate:

indexed-repeat(jr:choice-name (${HDFODRKH}, '${HDFODRKH}'),
${HouseholdDiet}, ${HouseholdDietIndex})
but the error message I get says "XPath evaluation: type mismatch
indexed-repeat():first parameter must be XPath field reference"

Do I need to separate into two calculations or is there a way to combine?

Thanks,
M

--

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