Help needed with this if-statement!

I want to write a simple if statement in which a farmer’s income is Y1 if he has a tubewell and y2 if not. I wrote the following:

if(${tubewell}=1),${y1},${y2}

But it says ‘unexpected comma outside function arguments.’ Where is my syntax wrong? Appreciate help.

  • FormLogicError: Could not evaluate: if( /model/instance[1]/a77FbkYUL8PBZQuy6zXZpq/tubewell =1), /model/instance[1]/a77FbkYUL8PBZQuy6zXZpq/y1 , /model/instance[1]/a77FbkYUL8PBZQuy6zXZpq/y2, message: Unexpected comma outside function arguments.{“stack”:[{“t”:“root”,“tokens”:[null]}],“cur”:{“v”:""}}

Where can I properly learn the syntax for formulas and functions in kobocollect. Is it the same as in Excel?

@TushaarKOBO, try this:

if((${tubewell}=1),${y1},${y2})

This post discussed previously should also help you provide an idea on how to use the if-statement: