Allowing a maximum of 2 choices that can be repeated in a repeat group

Hi Kalam,

I have a form where the user needs to select the site of tumor from a single select list within a repeat group. However, the user should not be allowed to select the same site more than twice. The list contains multiple sites like Lung, Liver, Bone, Brain, etc. If he selects the same site it should throw an error message. Could you please help me with this.

Anju.

@an_ju, maybe you could do it as outlined in the post discussed previously:

Thank you for the response. However, it does nt work for me.
Ideally in my form the user has the option to select upto a maximum of 5 lesions(tumors). But, he cannot select more than 2 location of the tumor. If he selects, it should throw an error message. But at the same time he should be able to input the number of lesions he has specified in the earlier question.
With the solution you suggested, it does not allow any of the location to be repeated.
Please have a look at the attachments. Thank you for your time.

SampleR.xls (144 KB)

Could you provide more details on this? This portion is a bit unclear at the moment.

Yes. So basically this is a form for the user to enter the number of tumors (lesions) and the location where the tumor is found. They can enter only upto a maximum of 5 tumors with a condition that the same location can be selected for only two tumors. For eg. If the user enters Total number of tumors = 4. Tumor 1 is found in lungs, Tumor 2 in Stomach, Tumor 3 in lungs, The user should not be able to select the location of Tumor 4 again as lungs since already same location has been selected twice. It should ask the user to select a different site or location. Hope I am able to clarify the situation.

Hi, I have got a workaround which seems to work. I tried with only one of the choice option currently.

However, the error message does not show the response in a proper way. Can you think of any way where the value of the sum does not show up in the error message.

SampleR.xls (146 KB)

@an_ju, you could do it as outlined in the image shared below:

In the survey tab of your XLSForm:

In the choices tab of your XLSForm:

Image 2

Data entry screen as seen in Enketo:

Reference XLSForm:

Accepting 2 repeats in a repeat group.xls (29.5 KB)

1 Like