Validation criteria taking into account two other questions

Good evening everyone, first to say that I am new to using kobotoolbox, second that my English is bad, I will try to be as clear as possible.
I am working on the form builder, looking at the documentation I have realized that my own code can be placed in the validation criteria, below I detail what I am trying to do:

I have three questions of type number: ${total}, ${numero1} and ${numero2}.
In the “total” question, you put a number, for example 10.
Then you must put two numbers in the other two questions (numero1 and numero2), the validation criteria for both must be the following: you cannot put numbers that, adding both questions, result in a number other than the “total” number, in this example 10.

the order of the questions are:

1- Total
2- Numero1
3- Numero2

I have placed the code that I will show below in the question ${numero1}

if(${numero2}!=“”, ${numero1} + ${numero2} == ${total},“”)

Welcome @metodologia,
Often using the search function of the forum (and the Help Center) can provide support and examples. See e.g. https://community.kobotoolbox.org/search?context=topic&context_id=37989&q=validation%20total&skip_context=true

2 Likes

@metodologia, you should be able to do it as outlined in the post discussed previously:

1 Like

@Kal_Lam your answer solved a lot of my problem but there is one more thing, let’s suppose that when going to the question ${numero2}, we answer it but at that moment we realize an error in the question ${numero1}, we answer it and that’s it the validation criteria does not work quite correctly because it does not take into account the answer of the question ${numero2}. I hope I have understood correctly