Get the position of a record in a roster based on specific value

The solution is below provided by Jane from ONA.
Thanks and regards

type name label repeat_count calculation
integer hhcount How many person in the household
begin_repeat roster ${hhcount}
text name What is the name of the Hh member
integer age What is the age of ${name}
select_one sex sex What is the sex of ${name}
end repeat
calculate min_age min(${age})
begin repeat check_youngest ${hhcount}
calculate pos_check position(…)
calculate age_comp indexed-repeat(${age}, ${roster}, position(…))
calculate name_comp indexed-repeat(${name}, ${roster},position(…))
calculate display_comp if(${age_comp} = ${min_age}, ${name_comp}, )
end repeat
calculate selected_name join(’ ',${display_comp})
note note_name Name selected: ${selected_name}
1 Like