dear Team,
I need to randomly select 1 eligible woman of age between 15 to 49 and man 15-59 from a household roster.
I modified this code according to this link:
https://designer.mysurvey.solutions/questionnaire/details/04b421596f0443e88cd99ec0538d89ff/chapter/5fbccbb5c1c16fc41e43681ae490187e/group/5fbccbb5c1c16fc41e43681ae490187e
Below is my code:
//Counting number eligible members
wnumEligible=MEMBERS.Count(x=>x.age.InRange(15,49) && x.gender==2)
//random index of eligible women
wrnd=(long)Math.Floor(Quest.IRnd()*wnumEligible.Value)
//MEMBERS.Where($x=>x.age.InRange(15,49) && x.gender==2).Select(z=>z.@rowcode).ToArray()[wrnd.Value]
//Name of randomly selected person
wselectname=membersList.Where(x=>x.Item1==wrandomRowcode).First().Item2.ToUpper()
But my code alwasy selects the first person within the roster row based on gender and the age category form.
what might be wrong? Your advice please