Hi everyone
I´m new in this community, I´m glad to be here. I have a question. I´ve been trying to run this logical function in a Kobo Form but I cant do it
Function:
SI(Y(medical_condition=“No”,disabilities=“No”),SUM(age,sex),SI(medical_condiction=“Yes”,”Medical conditions exist”,SI(disabilities=“yes”,”disability exists”,0)))
I want to SUM ages and sex values only when there´s not exit a medical condition or disability. And IF already exists some of last those then only count their value-
age: 18 0 25 (6 points) / 26 a 59 (10 points)
Medical condition: Yes/No
Disabilities: Yes/No
Welcome to the community, @KatherineMelendez! Maybe you will need to share your question, its conditions, and its value with the community. You may also need to share what you expect as an output.
i am facing the same issue , just wanted to know that does Kobo handle the multple if conditions along with “And” IN Constraint column
below is the constraint i used in form
IF((${ptpvisit2day} = ‘11’ and ${Amount_Collected_Today}>0),(.>today() and .<today()+28),IF((A${ptpvisit2day} = ‘22’),(.>today() and .<today()+5),(.>today() and .<today()+15)))
the later two conditions are giving perfect results but the first condition “((${ptpvisit2day} = ‘11’ and ${Amount_Collected_Today}>0),” is not working
please guide if any error in this “and” condition , or if i am missing something
La pregunta va mas enfocada a si se puede hacer de la siguiente manera:
if (${Discapacidad_cal1} = 0, ${Age0}+${Age1}+${Age2}+${Age3}+${Age4}, 5 and if (${Atencion_Salud_cal1} = 0, ${Age0}+${Age1}+${Age2}+${Age3}+${Age4},7)
if ((${ptpvisit2day} = ‘11’ and ${Amount_Collected_Today}>0),(.>today() and .<today()+28),IF((A${ptpvisit2day} = ‘22’),(.>today() and .<today()+5),(.>today() and .<today()+15)))
the later two conditions are giving perfect results but the first condition “((${ptpvisit2day} = ‘11’ and ${Amount_Collected_Today}>0),” is not working
please guide if any error in this “and” condition , or if i am missing something
There is still one capital IF in your copy.
Did you check your form with the Online validator? (Always recommended during form development) Open Data Kit - XLSForm Online
For testing, you could temporarily reduce your if condition to the first part, which is not working and try to better locate/understand the problem. You may also put ( today()+28 ) in brackets. And test this calculation in an extra (text) variable.
Hello @KatherineMelendez,
side-note. An age of 26 is not covered by the ranges in your age calculations. This will always result in a calculated value of 0.
if ((${ptpvisit2day} = ‘11’ and ${Amount_Collected_Today} !=" “),(.>today() and .<today()+28),if((${ptpvisit2day} = ‘22’),(.>today() and .<today()+5),if((${ptpvisit2day} = ‘11’ and ${Amount_Collected_Today} =” "),(.>today() and .<today()+15),(.>today() and .<today()+5))))
the below condition is not working
,if((${ptpvisit2day} = ‘11’ and ${Amount_Collected_Today} =" "),(.>today() and .<today()+15)
if((${ptpvisit2day} = ‘11’ and ${odrecdtoday} = ‘yes’ and ${Amount_Collected_Today} >500),(.>today() and .<today()+28),if((${ptpvisit2day} = ‘11’ and ${odrecdtoday} = ‘no’),(.>today() and .<today()+14),if((${ptpvisit2day} = ‘22’ and ${odrecdtoday} = ‘yes’ and ${Amount_Collected_Today} >500),(.>today() and .<today()+28),(.>today() and .<today()+5))))