Jr:choice-name using relative path

I am trying to get the selected choic label of a select_one which is within the current repeated group, but one level higher.

type | name | hint| calculation
begin repeat | defect
...
select_one inspection_criteria | inspection_criterium
...
begin group	| color
calculate | selected_insp_crit | ... | jr:choice-name(Check/defect/inspection_criterium,'Check/defect/inspection_criterium')
note | selected_insp_crit_disp | ${selected_insp_crit}
end repeat

This does not give a hint in the note.

I also tried jr:choice-name(${inspection_criterium}, '${inspection_criterium}') or relative: jr:choice-name(../inspection_criterium}, '../inspection_criterium')

I'd be glad if somebody could point me into the right direction.

Thanks.

Regards

Joachim Werner

I haven't used relative pathing before, but to me your jr:choice-name(${inspection_criterium}, '${inspection_criterium}') looks good, assuming you weren't in a repeat group.

Just to clarify, when you say you are "trying to get the ...choice label ...which is (not) within the current repeated group, but one level higher", do you mean (a) not within the current "group" (e.g. group: 'color') but one level higher (e.g. repeat group: 'defect')? I think that is what you mean, rather than (b) "the previous iteration of the repeat group"?

If indeed you mean (a), I think you could try the following:

jr:choice-name(
  indexed-repeat(${inspection_criterium}, ${defect}, position(..)), 
  'indexed-repeat(${inspection_criterium}, ${defect}, position(..))'
)

It's possible there may be an error in my syntax, but I would try this. Let me know if you have any questions~

This does not work. A workaround is to make a dummy question outside of the repeat at the top/flat/non-repeating level using the same value list, that you can then use as the reference to pull in the value. Something like:

jr:choice-name(../inspection_criterium, '${inspection_dummy}')

Where inspection_dummy is a question that will never show (maybe relevancy 1=2), but that utilizes the same values list as insepection_criterium.

Jason

I agree w/ Jason that using a reference list like that is an elegant solution.

As he mentioned, you'll want the relevant to evaluate to false, so setting the it to something like 1=2 will work. I usually just set such things to 0.