Constraint doesn't work when in a repeat group

Hi Folks,
I have built a form where I want to constrain the value of subsequent answers to the value given in Q1. I can successfully do this so long as this series of questions is not in a repeat-group (see
quadrat nut analyses.xlsx (11.4 KB)
). As soon as I wrap the same coding into a group that repeats, it no longer works (see
quadrat nut analyses 1.xlsx (12.5 KB)
) . I have tried playing with the what is in the “relevant” column, but this seems to make no difference. Can anyone please tell me what I am doing wrong here?

Many thanks,
Tania

1 Like

@taniak, could you highlight the part in your XLSForm that is not working when putting it inside the repeat group?

Hi Tania,

To get your form working properly in KoboToolbox, you need to make two quick fixes:

Rename variables with duplicate names

  • quadrat_nuts appears in rows 3 and 8
  • quadrat_clean appears in rows 9 and 21

Fix the constraint syntax

This line: ${quadrat_nuts}! = ${quadrat_check} is invalid.

The correct syntax is: ${quadrat_nuts} != ${quadrat_check}

After making these two adjustments, save and upload your form again to KoboToolbox. That should allow the form to load, and then you can test whether the conditional logic inside the repeat works as expected.

Best,

Cristian Sanabria.

Hi Christian,

D’Oh! You are absolutely correct, and that changing those names has resolved the issue. I don’t know how I managed to do that, or why I didn’t catch that error. I knew it had to be something I did wrong, but I couldn’t work that out. Interestingly, I haven’t changed the syntax of the constraint (as you indicate I need to do), and it still works. Go figure. But thank you so much for catching the other mistakes – I really appreciate it.

Tania

1 Like

Hi Tania,

I’m really glad I could help and happy to hear it’s working now! If everything is resolved, feel free to mark the topic as solved so others can find it more easily.

Best
Christian