Issue with visibility of questions outside a repeat, based on relevant answers within a repeat

270
4
Jump to solution
10-25-2021 07:38 AM
Sarah-CodyKnight
New Contributor II

Hi, I'm using Survey123 version 3.12.232

Within my survey, I have a multiple choice question ("plant species") within a repeat. Outside of the repeat,  I have a unique question for each plant species's seed weight. I want a species specific weight question to be visible if a certain species was selected across all the repeats.

My problem is, the weight questions (outside the repeat) only appear depending on which repeat I am looking at in the form view of Survey123 Connect. If I am looking at one repeat, the species weight questions are appearing for ONLY the answers selected in that repeat. If I look at another repeat, same thing.

How do I make all the relevant questions outside the repeat appear, based on the answers across ALL the repeats?

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Frequent Contributor

Join can take all the values from the repeat question and return a single string.

join(',', ${question_in_repeat})

After that, you can use contains to look for specific values.

contains(${question_one}, 'some species')
- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
4 Replies
DougBrowning
MVP Frequent Contributor

I think you would have to count them up and then compare to the number of repeats.

In each repeat do a if(contains(species), 1, 0).  Then outside compare count(speciescount) to a count of the repeat (using max(position) or count(any repeat filed).

You could also do if(contains(species), yes, no).  Then your relevant is not(contains(no)) on a field that is join(IfYesNoFieldAbove).

Hope that makes sense.

0 Kudos
jcarlson
MVP Frequent Contributor

Join can take all the values from the repeat question and return a single string.

join(',', ${question_in_repeat})

After that, you can use contains to look for specific values.

contains(${question_one}, 'some species')
- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
Sarah-CodyKnight
New Contributor II

Thank you both! I tried @jcarlson 's solution because it was simpler, and it worked well.

0 Kudos
DougBrowning
MVP Frequent Contributor

A join and contains would tell you if the species is in any repeat.  You said you want it if it is in all repeats.  Totally different.

0 Kudos