Ranking previously collected list of names

Thanks for including that detail. I think it's really important to always start by considering alternative ways to present the information and questions to respondents. Asking for siblings in their birth order would be my natural first inclination. A related question would be whether you really need to ask for the order or whether you can derive it from the ages given. Are you concerned two siblings might have the same age? That a respondent may not know one of his or her siblings' age but could order them?

If you really do need to get the respondent to order the siblings, how do you plan on analyzing that resulting data? That will help figure out the best way to represent the sibling order.

@Joseph_E_Flack_IV's approach can work if you know a maximum number of siblings but as he described, it's somewhat tedious.

You can rank a dynamic list from a repeat in XForms but unfortunately there isn't yet a great way to represent this in XLSForm. There's an issue filed at https://github.com/XLSForm/pyxform/issues/38 to add that functionality.

In the mean time, you can make a small XML modification to an XLSForm as described at Generate multiple choice alternatives, based on the answers in a repeat - #4 by LN.

For your scenario, I started with this XLSForm, converted it and then replaced the rank item definition with

		<odk:rank ref="/rank-from-select/sibling_ages">
			<label>Please order the siblings from youngest to oldest</label>
			<itemset nodeset="/rank-from-select/siblings">
				<value ref="current_sibling"/>
				<label ref="sibling_name"/>
			</itemset>
		</odk:rank>

Fully working XML: rank-from-select.xml (2.6 KB)

4 Likes