Error when setting constraint

Hi @elmps2018,demogForm.xlsx (19.2 KB)

It works well. But it throws error when we set the constraint. For example, here if I put regex validation for age. It doesn’t work. Could you please guide me?
Thanks.

Hi @nsthakuri!

I moved this to a separate topic since it’s a separate issue, and splitting it out will help future forum readers!

So for setting a constraint, I am not quite sure what sort of syntax you were trying to use here, but we have used something like this successfully as a constraint to ensure a variable (a month one) was between 1-12 or 98: (data(‘q305_1’) >= 1 && data(‘q305_1’) <= 12) || data(‘q305_1’) == 98

I think you could update this syntax for your case.

Best,
Caroline

Thanks @elmps2018demogForm.xlsx (19.2 KB)
for moving into different issue.
In this example, I would like to skip questions 1,2 and 3 when consent is not given. When I try to save by touching finalize button, I am getting error to ask required all questions.
Thanks,

This most likely means there is some typo in the constraint … looking at your excel quick, it looks like the choices may not be set up right? I think you want to use =“1” for the responses to the consent question in the choices, and you have '“1” so that may mean there’s an inconsistency. You can also switch to using the new select_one_integer (see here: ODK-X XLSX Converter Reference — ODK-X Docs) which means you don’t have to do all the quotes etc. for it to work.

Hopefully one of those solves it!

Best,
Caroline