Do not show Repeat Group for "Others" or "None"

Hi all,

I am using the repeat group feature and developing the form using excel. I have a question asking which degrees a person has completed after which questions relevant to each degree follow. I don’t want these questions to show in case “Others” or “None” are selected?
I was adding a simple code in the relevant column of the xlsform stating not(${Degree}=“Others”). It works as long as I only select Others. If I select, for example, Bachelors and also Others, then the repeat group starts to show for Bachelors (as it should) and Others (as it should not).

Please tell me what i am doing incorrectly here.

Hi @eeshatariq
I believe the behavior you desire to create should match the behavior that has been discussed here

Kindly have a look and customize it to your needs. If you experience any problems, please do not hesitate to reach out.

Stephane

1 Like

Hi @stephanealoo thanks for your reply. No actually, I just want to restrict a repeat group to not appear for one particular option (for example “Others”). I still want the repeat group to appear for all other options selected.
Normally, I would add it in the “relevant” column. But it doesn’t seem to be working here. I am attaching this image for reference:

Then the issue is with your repeat count since the count presents all the selections including other.

I would recommend adding a calculate question which would do the following

if(selected(${UK_Degree},‘other’),(count-selected(${UK_Degree})-0),(count-selected(${UK_Degree})))

Then reference the calculate question on the repeat_count

Stephane

1 Like

Thank you for your response! I tried doing this, but if I selected 3 degrees, it only shows the repeat group for 1. I want it to shoe for all the degrees, except other.
Attaching what I did for reference:

Never mind @stephanealoo I understand what you meant, have done it and achieved the desired result, thank you very much!!

1 Like

Hi @eeshatariq
Just to close the loop, could you screenshot the part of the working form that you worked with to resolve the issue?

Stephane

Yes sure. You’ll note that I did -1 instead of -0 in the code you shared. So essentially used
if(selected(${UK_Degree},‘other’),(count-selected(${UK_Degree})-1),(count-selected(${UK_Degree})))
Uploading here:

2 Likes

Nice catch on the -0, not sure what I was thinking :thinking:

1 Like

@eeshatariq, thank you for this workaround. Documenting the same in an xlsform so that community could use it if and when needed:

In the survey tab of your xlsform:

In the choices tab of your xlsform:

Image 2

Data entry screen as seen in Enketo: (repeat for other not shown, condition 1)

Data entry screen as seen in Enketo: (repeat for other not shown, condition 2)

Reference xlsform:

color.xlsx (10.8 KB)

1 Like

hey @Kal_Lam,
I want to ask you something, I’ve tried the colors example on the android kobo collect app
and it opens a loop if the first option was selected is other with just one option and if other selected alone also the loop will open for it,

could you please tell me if there is a solution for that on the kobo collect app.

best,
Ahmad.