Hello @TushaarKOBO,
It seems the number of your brackets ( …) is not balanced.
I would recommend always checking your form during development with the online validator.
@TushaarKOBO, try this out as advised by @wroos (you had a bracket mis-match):
if((${q1}=0),1200,if((${q1}=1),2000,if((${q1}=2),3000,if((${q1}=3),3600,if((${q1}=4),4000,if((${q1}=5),4200,''))))))
Thanks so much. I was stuck on this these past 3 days.
if${tubewell}=1,"${y1}","${y2}"
what is the problem with the above? It says unexpected comma.
Regards,
Tushaar
Hello,
if(…). Add brackets, please.
@TushaarKOBO, maybe this post discussed previously should help you understand and use the if-statement
properly:
Thanks so much for your help and guidance.
Yes, I think there is a syntax issue. Below is what the online validator says. However, I am able to preview the form in my laptop.
I want to ask: Do you have a tubewell?
In choices, I put tubewell in two rows, 1 and 0 as names and Yes and No as labels.
Could this be why I can not ‘get selected’ form on my android?
I can preview my form all right but am unable to deploy my form. I get server error (500).
What should I do?
Appreciate your help.
Today morning I tried again and my form got deployed and I could also download it on my android.
Sorry to have bothered unnecessarily, and thanks a lot.
I want that if (tubewell) tw is equal to either dtw, etw or stw or either two of them or all of them, the respondent is a water seller; else a water buyer. I tried the following but did not work. can you pl help? Earlier, I tried ‘or’ instead of ‘and’ but that excluded respondent having 2 of three or all three and called them water buyers. Also in that case, ‘water_buyer’ came up on its own and changed only when respondent had a dtw or etw or stw.
if((${tw}=“dtw”)and(${tw}=“etw”)and(${tw}=“stw”), “water_seller”,“water_buyer”,"")
Any guidance appreciated.
Thanks.
I also tried this; but with similar results:
if((${tw}=“dtw”)or(${tw}=“etw”)or(${tw}=“stw”)or((${tw}="dtw"and ${tw})=“etw”)or((${tw}="etw"and${tw})=“stw”)or((${tw}="dtw"and${tw})=“stw”)or((${tw}="dtw"and${tw}="etw"and${tw})=“stw”), “water_seller”,“water_buyer”)
Hello @TushaarKOBO,
this seems a problem of your if logic, not of KoBo, please. You may develop and test your if clause step-by-step, starting with a small combknation.
Can you please tell me what is wrong with this calculate formula?
if((${yd}<1000),150, if((${yd}>1000), and (${yd}<2500)), 200, if((${yd}>2500), 250,’ '))
I want to say that labour needed is 150 days if crop yield is <1000 kg/acre, 200 days if yield is between 1000 and 2500 and 250 days if yield exceeds 2500 kg.
Regards,
Tushaar
Hello @TushaarKOBO,
remove the comma before the and.
You may always check your form during development with the Online validator ODK - XLSForm Online v2.x
Thanks so much. It did the trick.
Regards,
Tushaar
This didn’t work for me…if I put 1 , the result is 1. How can I figure out that.
Thank you.
Hi @estalyly, welcome to the community,
Can you share a screenshot of the calculation you use so we can take a closer look?