Validation Code - additional condition

Dear Community,

I have question relate to validation code with two condition A and B
if A = 0 then B Should 0, if A>0 then B should more than 50 miliion

then the code is (${A}=0 and .=0) or (${A}!=0 and .>=50000000)

Let me know if I’m wrong

Best,
Thank You

You could do it as outlined in the image shared below:

In the survey tab of your xlsform:

Data entry screen as seen in Enketo: when a condition is not satisfied

Data entry screen as seen in Enketo: when a condition is satisfied

Data entry screen as seen in Enketo: when a condition is not satisfied

Data entry screen as seen in Enketo: when a condition is satisfied

Reference xlsform:

Constraint.xls (37.5 KB)

Hi @Kal_Lam

Thank you so much for help. Just confirm for message, we cannot define dynamic message by if then else right?

Best,
Budi

If this is what you wish to design, you could do it as outlined in the image shared below:

In the survey tab of your xlsform:

Data entry screen as seen in Enketo: when a condition is not met

Data entry screen as seen in Enketo: when a condition is met

Data entry screen as seen in Enketo: when a condition is not met

Data entry screen as seen in Enketo: when a condition is met

Reference xlsform:

Constraint.xls (38 KB)

Thanks @Kal_Lam very help me so much.

Best,
Budi

1 Like