Use of jr:choice-name in xlsform

Hi Team, I wanted to refer to a label using jr:choice-name. Can any team
member give me a step by step way of using it to refer to previously
entered choice label in xlsform.

I have tried and i keep getting this error message: Error: "... There has
been a problem trying to replace ${livestockactivity_list} with the XPath
to the survey element named 'livestockactivity_list'. There is no survey
element with this name..."

Thanks.

Collins

Collins,

jr:choice-name cannot have a blank value for its first argument. See
https://groups.google.com/d/msg/opendatakit/A8GBWt8cYvo/4r-NsLXAbZcJ
for the details.

Workaround is something like this:
if(string-length(${livestockactivity_list}) !=
0,jr:choice-name(${livestockactivity_list},'${livestockactivity_list}'),'(unspecified
livestockactivity)')

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Mon, Nov 18, 2013 at 1:25 AM, Collins McAdoyo collins.adoyo@gmail.com wrote:

Hi Team, I wanted to refer to a label using jr:choice-name. Can any team
member give me a step by step way of using it to refer to previously entered
choice label in xlsform.

I have tried and i keep getting this error message: Error: "... There has
been a problem trying to replace ${livestockactivity_list} with the XPath to
the survey element named 'livestockactivity_list'. There is no survey
element with this name..."

Thanks.

Collins

--

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/groups/opt_out.

2 Likes

Dear @yanokwa, I'm trying to access the google group you mentioned in this post, but it seems unavailable. Is the group or the post still active?
I want to learn more on jr:choice-name, can you redirect me to relevant materials?
thanks, Lavinia

Hi @Lavinia_Plataroti, you can use CTRL + "F" to find "jr:choice-name" on this page of the documentation: https://docs.getodk.org/form-operators-functions/ - it's in the section on selected()

Hi there!
I read the docs but have another question: in my form, I first have a select_one question and then a begin group, wherein I included a jr:choice-name to refer to the select_one question outside of the group.
Is this funcionality supported? what could be a workaround?
I tried the path described in the docs, having the select_one questiton within the begin group and used the jr functon worked perfectly.
Thanks!

Is your group a repeat group? If yes, and you want to reference a question in the repeat group from outside of the group then you will need to know which number of the repeat you want. See: https://docs.getodk.org/form-repeats/#referencing-repeated-questions-from-outside-the-repeat

If it's a regular group (not a repeat), you shouldn't need to do anything special. If you are having issues please attach the XLSForm sample here to help people troubleshoot.

problem solved! thanks!