Select an 5-15 years old household member randomly

Hi,
I really appreciate it. Thanks a lot. I look into the excel files later.

Many thanks
Pierre

··· Le 17 juin 2016 11:02, a écrit :

I found an easier way to do this. So please check
In this example I want to select the index position of a girl between 5
and 17.
steps.

  1. inside the begin repeat a calculate a variable that has the position of
    the member inside the repeat that matches the condition. i use:
    Better you see the attached xls file.

calculate eligibleGirl
if(${age}>4 and ${age}<18 and
${female}=1,position(..),'')

  1. Outside the repeat i use the following functions : random(); join();
    count-selected(), and selected-at(). once i have the index of the random
    selected girl i can use indexed-repeat() to get the name or idnumber.

calculate random1
once(random())
note note1 random number is ${random1}
calculate listgirspos
join(' ',${eligibleGirl})
note note2 girls' positions are ${listgirspos}
calculate n_selected
count-selected(${listgirspos})
note note3 Number of girls selected ${n_selected}
calculate selectedGirl

selected-at(${listgirspos},int(${random1}*${n_selected}))
note note4 the Girl selected is ${selectedGirl}

On Saturday, July 12, 2014 at 9:23:21 PM UTC-4, Legarraudien wrote:

I think i attached the wrong file,
please fiind attached xlsfom

Le samedi 7 juin 2014 14:16:28 UTC-7, Legarraudien a écrit :
Hi guys,
I have a big challenge to select randomly a 5-15 years old household
member. I have a questionnaire with two sections. the first section ask
questions about democraphics, economics for each member. In the second
second, we have to select randomly a 5-15 years old to ask specifics
questions. I don't know how can I do it in odk? Can sombody tell me how
can adresse this issue?
thanks a lot