Using indexed-repeat function to fill set number of answers

First off, I really like the indexed-repeat function so thanks to all
involved in adding this to ODK.

I have a question though - say you ask a repeat set of questions to a
household e.g. name, age etc. Then after the repeat group you ask a
question e.g. Who does the washing up? and you want the answers to list all
household members already entered, this can be done with indexed-repeat.
However you have to pre-define the number of entries in the list and all
entries will be shown even if they don't have a value ie if 3 people are in
a household and you define 5 answers then 7 will not have a visible label.
The main problem with this is that a user can select an option for which
there is no person associated. Has anyone worked out how to make this an
invalid selection or to shrink the list to only the number of people listed?

I currently shrink the list by creating a number of identical questions
that differ only in the number of options associated with them and the
relevance

Who does the washing up? (Relevance: Number Of people = 1)
A1 - Person1

Who does the washing up? (Relevance: Number Of people = 2)
A1 - Person1
A2 - Person2

Who does the washing up? (Relevance: Number Of people = 3)
A1 - Person1
A2 - Person2
A2 - Person3

etc etc

It works perfectly well, but it is a bit clunky so was wondering if anyone
had found a neater solution?

Hi Daniel,

You can use cascading-select filters for this!

Just pull the count() from the repeat group into a calculate field (named,
e.g., "n_hh_members"), then add a filter column to your choices sheet
(with, e.g., 1, 2, 3, etc.), then use the choice_filter column to filter
choices on the survey sheet (e.g., "filter <= ${n_hh_members}"). The only
restriction is that the n_hh_members field can't itself be inside a repeat
group, as cascading-select expressions can't pull values from repeat groups
right now. (We really need to fix that!)

It's still unfortunate that you need to populate the Person1, Person2, etc.
fields, but with cascading selects at least blank options won't appear.

Best,

Chris

··· On Fri, Oct 4, 2013 at 4:41 AM, dj_bridges wrote:

First off, I really like the indexed-repeat function so thanks to all
involved in adding this to ODK.

I have a question though - say you ask a repeat set of questions to a
household e.g. name, age etc. Then after the repeat group you ask a
question e.g. Who does the washing up? and you want the answers to list all
household members already entered, this can be done with indexed-repeat.
However you have to pre-define the number of entries in the list and all
entries will be shown even if they don't have a value ie if 3 people are in
a household and you define 5 answers then 7 will not have a visible label.
The main problem with this is that a user can select an option for which
there is no person associated. Has anyone worked out how to make this an
invalid selection or to shrink the list to only the number of people listed?

I currently shrink the list by creating a number of identical questions
that differ only in the number of options associated with them and the
relevance

Who does the washing up? (Relevance: Number Of people = 1)
A1 - Person1

Who does the washing up? (Relevance: Number Of people = 2)
A1 - Person1
A2 - Person2

Who does the washing up? (Relevance: Number Of people = 3)
A1 - Person1
A2 - Person2
A2 - Person3

etc etc

It works perfectly well, but it is a bit clunky so was wondering if anyone
had found a neater solution?

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

This is what actually I am stuck with. Would appreciate if some of you could spare some time to explain it step by step as I'm new to ODK.

In my XLSForm I capture household member no. and household member name in repeat group and now I want to populate this member name along with member no in non-repeat form where I can select it.

Thank you in advance.

Sorry this has taken me so long to respond to!

Chris - great solution, my form is much simpler now..... Thank you for the
tip!

Hi Sonam,

Sorry for the late reply. I've been busy over the holidays. Have you
figured this out by now or are you still looking for help?

Best,
Mark

··· On Sun, Dec 21, 2014 at 2:28 AM, wrote:

This is what actually I am stuck with. Would appreciate if some of you
could spare some time to explain it step by step as I'm new to ODK.

In my XLSForm I capture household member no. and household member name in
repeat group and now I want to populate this member name along with member
no in non-repeat form where I can select it.

Thank you in advance.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/_tH-5ecX-Uc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mark Gross
University of Maryland
Department of Sociology
4114 Art-Sociology

Hi Chris,

Is there any way to do this same thing but combing multiple lists of names into one? For instance if I have a number of different rosters throughout a questionnaire (all with separate follow up questions) and wanted a list of ALL of the names from all of the rosters that have been entered prior to appear at the end so I can ask a repeat set of questions for everyone.

Thanks for the help!

Best,
Mark Gross

··· On Tuesday, October 22, 2013 8:19:16 AM UTC-4, dj_bridges wrote: > Sorry this has taken me so long to respond to! > > Chris - great solution, my form is much simpler now..... Thank you for the tip!

Hi Mark,

If you have a solution - pl share ? It 'll be great.

Thankyou

··· On Friday, January 9, 2015 at 7:40:39 PM UTC+5, Mark Gross wrote: > Hi Sonam, > > Sorry for the late reply. I've been busy over the holidays. Have you figured this out by now or are you still looking for help? > > Best, > Mark > > > > On Sun, Dec 21, 2014 at 2:28 AM, wrote: > This is what actually I am stuck with. Would appreciate if some of you could spare some time to explain it step by step as I'm new to ODK. > > > > In my XLSForm I capture household member no. and household member name in repeat group and now I want to populate this member name along with member no in non-repeat form where I can select it. > > > > Thank you in advance. > > > > > > -- > > -- > > Post: opend...@googlegroups.com > > Unsubscribe: opendatakit...@googlegroups.com > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > --- > > You received this message because you are subscribed to a topic in the Google Groups "ODK Community" group. > > To unsubscribe from this topic, visit https://groups.google.com/d/topic/opendatakit/_tH-5ecX-Uc/unsubscribe. > > To unsubscribe from this group and all its topics, send an email to opendatakit...@googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. > > > > > -- > > Mark Gross > University of Maryland > Department of Sociology > 4114 Art-Sociology

Hi Mark,

I believe that it's possible, but it would required somewhat-tortured use
of if() statements, I believe, in order to sum up your roster counts and
draw individual names from the earlier rosters. For example, name #7 may
draw the 7th name from the first roster (in cases where it has >= 7 names)
or maybe the 3rd name from the second roster (in cases where the first
roster has four and the second >= 3), and so on. If you had just two
rosters, maybe it wouldn't be too painful; if you had more than three or
four, it might well become impossible. In any case, you'd be doing a lot of
very careful coding...

Best,

Chris

··· On Mon Dec 15 2014 at 6:40:18 PM wrote:

On Tuesday, October 22, 2013 8:19:16 AM UTC-4, dj_bridges wrote:

Sorry this has taken me so long to respond to!

Chris - great solution, my form is much simpler now..... Thank you for
the tip!

Hi Chris,

Is there any way to do this same thing but combing multiple lists of names
into one? For instance if I have a number of different rosters throughout a
questionnaire (all with separate follow up questions) and wanted a list of
ALL of the names from all of the rosters that have been entered prior to
appear at the end so I can ask a repeat set of questions for everyone.

Thanks for the help!

Best,
Mark Gross

Hello,

I am also struck on the same thing. I want to get the total household
members after repeat group and want to display them in choices option. Any
example would be great.

··· On Tuesday, 20 September 2016 23:02:11 UTC+5, afa...@gmail.com wrote: > > Hi Mark, > > If you have a solution - pl share ? It 'll be great. > > Thankyou > > > On Friday, January 9, 2015 at 7:40:39 PM UTC+5, Mark Gross wrote: > > Hi Sonam, > > > > Sorry for the late reply. I've been busy over the holidays. Have you > figured this out by now or are you still looking for help? > > > > Best, > > Mark > > > > > > > > On Sun, Dec 21, 2014 at 2:28 AM, wrote: > > This is what actually I am stuck with. Would appreciate if some of you > could spare some time to explain it step by step as I'm new to ODK. > > > > > > > > In my XLSForm I capture household member no. and household member name > in repeat group and now I want to populate this member name along with > member no in non-repeat form where I can select it. > > > > > > > > Thank you in advance. > > > > > > > > > > > > -- > > > > -- > > > > Post: opend...@googlegroups.com > > > > Unsubscribe: opendatakit...@googlegroups.com > > > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > > > > > --- > > > > You received this message because you are subscribed to a topic in the > Google Groups "ODK Community" group. > > > > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/opendatakit/_tH-5ecX-Uc/unsubscribe. > > > > To unsubscribe from this group and all its topics, send an email to > opendatakit...@googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > > > > > > > > > > -- > > > > Mark Gross > > University of Maryland > > Department of Sociology > > 4114 Art-Sociology > >

Hi Chris,

Thank you so much for the quick reply! Your point makes sense and I was
sort of figuring that something like that would be the case. As it stands
now I've been able to generate the list containing all of the names from
all of the rosters but there are blanks for all of the non-entries in the
rosters (I've made it so there are 5 pre-defined possible entries). So if
in roster1 I have 3 entries (A, B, C) and in Roster2 I have 2 entries D, E)
the list appears like this:

A
B
C
(blank)
(blank)
D
E
(blank)
(blank)
(blank)

Might there be some clever way using choice_filter to eliminate the blanks?

I am new to ODK so bear with me if I miss anything.

Thanks again!
Mark

··· On Mon, Dec 15, 2014 at 6:46 PM, Christopher Robert wrote: > > Hi Mark, > > I believe that it's possible, but it would required somewhat-tortured use > of if() statements, I believe, in order to sum up your roster counts and > draw individual names from the earlier rosters. For example, name #7 may > draw the 7th name from the first roster (in cases where it has >= 7 names) > or maybe the 3rd name from the second roster (in cases where the first > roster has four and the second >= 3), and so on. If you had just two > rosters, maybe it wouldn't be too painful; if you had more than three or > four, it might well become impossible. In any case, you'd be doing a lot of > very careful coding... > > Best, > > Chris > > > On Mon Dec 15 2014 at 6:40:18 PM wrote: > >> On Tuesday, October 22, 2013 8:19:16 AM UTC-4, dj_bridges wrote: >> > Sorry this has taken me so long to respond to! >> > >> > Chris - great solution, my form is much simpler now..... Thank you for >> the tip! >> >> Hi Chris, >> >> Is there any way to do this same thing but combing multiple lists of >> names into one? For instance if I have a number of different rosters >> throughout a questionnaire (all with separate follow up questions) and >> wanted a list of ALL of the names from all of the rosters that have been >> entered prior to appear at the end so I can ask a repeat set of questions >> for everyone. >> >> Thanks for the help! >> >> Best, >> Mark Gross >> >> >> >> >> >>

--
Mark Gross
University of Maryland
Department of Sociology
4114 Art-Sociology

Hi Mark,

One idea would be to have a field with a 1 or a 0 for every name, based on
the expression "string-length(${name})>0", then join()/concat() all of
those into a space-separated list. In your example case, you'd have a
string like "1 1 1 0 0 1 1 0 0 0". Then, use the filter column on the
choices sheet to list the index numbers (1, 2, 3, ..., 10). Finally, in the
choice_filter column, use selected-at() to grab the xth number from your
space-separated list (it would be a calculate field masquerading as a
select_multiple field) and see if it's 1.

Again, this is very advanced stuff. I'm only painting the rough outline of
a solution here. It will probably take some cleverness and hard work to
make everything function the way you'd like.

Best,

Chris

··· On Mon Dec 15 2014 at 7:04:38 PM Mark Gross wrote:

Hi Chris,

Thank you so much for the quick reply! Your point makes sense and I was
sort of figuring that something like that would be the case. As it stands
now I've been able to generate the list containing all of the names from
all of the rosters but there are blanks for all of the non-entries in the
rosters (I've made it so there are 5 pre-defined possible entries). So if
in roster1 I have 3 entries (A, B, C) and in Roster2 I have 2 entries D, E)
the list appears like this:

A
B
C
(blank)
(blank)
D
E
(blank)
(blank)
(blank)

Might there be some clever way using choice_filter to eliminate the blanks?

I am new to ODK so bear with me if I miss anything.

Thanks again!
Mark

On Mon, Dec 15, 2014 at 6:46 PM, Christopher Robert <crobert@surveycto.com wrote:

Hi Mark,

I believe that it's possible, but it would required somewhat-tortured use
of if() statements, I believe, in order to sum up your roster counts and
draw individual names from the earlier rosters. For example, name #7 may
draw the 7th name from the first roster (in cases where it has >= 7 names)
or maybe the 3rd name from the second roster (in cases where the first
roster has four and the second >= 3), and so on. If you had just two
rosters, maybe it wouldn't be too painful; if you had more than three or
four, it might well become impossible. In any case, you'd be doing a lot of
very careful coding...

Best,

Chris

On Mon Dec 15 2014 at 6:40:18 PM markcgross@gmail.com wrote:

On Tuesday, October 22, 2013 8:19:16 AM UTC-4, dj_bridges wrote:

Sorry this has taken me so long to respond to!

Chris - great solution, my form is much simpler now..... Thank you
for the tip!

Hi Chris,

Is there any way to do this same thing but combing multiple lists of
names into one? For instance if I have a number of different rosters
throughout a questionnaire (all with separate follow up questions) and
wanted a list of ALL of the names from all of the rosters that have been
entered prior to appear at the end so I can ask a repeat set of questions
for everyone.

Thanks for the help!

Best,
Mark Gross

--
Mark Gross
University of Maryland
Department of Sociology
4114 Art-Sociology

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Chris,

Thanks again for getting back to me so quickly. I will try this out today
but as its rather advanced and my ODK/XML skills are not I probably will
have to settle for the list with extra blanks. Thanks for the help!

Best,
Mark

··· On Mon, Dec 15, 2014 at 8:53 PM, Christopher Robert wrote: > > Hi Mark, > > One idea would be to have a field with a 1 or a 0 for every name, based on > the expression "string-length(${name})>0", then join()/concat() all of > those into a space-separated list. In your example case, you'd have a > string like "1 1 1 0 0 1 1 0 0 0". Then, use the filter column on the > choices sheet to list the index numbers (1, 2, 3, ..., 10). Finally, in the > choice_filter column, use selected-at() to grab the xth number from your > space-separated list (it would be a calculate field masquerading as a > select_multiple field) and see if it's 1. > > Again, this is very advanced stuff. I'm only painting the rough outline of > a solution here. It will probably take some cleverness and hard work to > make everything function the way you'd like. > > Best, > > Chris > > > On Mon Dec 15 2014 at 7:04:38 PM Mark Gross wrote: > >> Hi Chris, >> >> Thank you so much for the quick reply! Your point makes sense and I was >> sort of figuring that something like that would be the case. As it stands >> now I've been able to generate the list containing all of the names from >> all of the rosters but there are blanks for all of the non-entries in the >> rosters (I've made it so there are 5 pre-defined possible entries). So if >> in roster1 I have 3 entries (A, B, C) and in Roster2 I have 2 entries D, E) >> the list appears like this: >> >> A >> B >> C >> (blank) >> (blank) >> D >> E >> (blank) >> (blank) >> (blank) >> >> Might there be some clever way using choice_filter to eliminate the >> blanks? >> >> I am new to ODK so bear with me if I miss anything. >> >> Thanks again! >> Mark >> >> >> >> >> >> >> >> >> On Mon, Dec 15, 2014 at 6:46 PM, Christopher Robert < crobert@surveycto.com> wrote: >>> >>> Hi Mark, >>> >>> I believe that it's possible, but it would required somewhat-tortured >>> use of if() statements, I believe, in order to sum up your roster counts >>> and draw individual names from the earlier rosters. For example, name #7 >>> may draw the 7th name from the first roster (in cases where it has >= 7 >>> names) or maybe the 3rd name from the second roster (in cases where the >>> first roster has four and the second >= 3), and so on. If you had just two >>> rosters, maybe it wouldn't be too painful; if you had more than three or >>> four, it might well become impossible. In any case, you'd be doing a lot of >>> very careful coding... >>> >>> Best, >>> >>> Chris >>> >>> >>> On Mon Dec 15 2014 at 6:40:18 PM wrote: >>> >>>> On Tuesday, October 22, 2013 8:19:16 AM UTC-4, dj_bridges wrote: >>>> > Sorry this has taken me so long to respond to! >>>> > >>>> > Chris - great solution, my form is much simpler now..... Thank you >>>> for the tip! >>>> >>>> Hi Chris, >>>> >>>> Is there any way to do this same thing but combing multiple lists of >>>> names into one? For instance if I have a number of different rosters >>>> throughout a questionnaire (all with separate follow up questions) and >>>> wanted a list of ALL of the names from all of the rosters that have been >>>> entered prior to appear at the end so I can ask a repeat set of questions >>>> for everyone. >>>> >>>> Thanks for the help! >>>> >>>> Best, >>>> Mark Gross >>>> >>>> >>>> >>>> >>>> >>>> >> >> -- >> Mark Gross >> University of Maryland >> Department of Sociology >> 4114 Art-Sociology >> >> -- >> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "ODK Community" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to opendatakit+unsubscribe@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > -- > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en > > --- > You received this message because you are subscribed to a topic in the > Google Groups "ODK Community" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/opendatakit/_tH-5ecX-Uc/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > opendatakit+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. >

--
Mark Gross
University of Maryland
Department of Sociology
4114 Art-Sociology