hello please help
I have to put scores for my answers and Iβm getting errors! I have a question about age as the following:
Age:
50+
18 - 24
25 -49
and each option of these should have a score. option 1 should have a zero score, option 2 should have a 2 score and option 3 should have a 4 score.
I am not able to configure the if statements and so on! also I started this project freshly on Kobo toolbox meaning that I do not have it on Excel.
I have been trying several formulas including: if(selected(${age},β0β),β0β,ββ),if(selected(${age},β2β),β2β,ββ),if(selected(${age},β4β),β4β,ββ))
Welcome @basselalkan,
You need to keep to the syntax of a cascading if.
if( selected(${age},β0β), β0β if( selected(${age},β2β), β2β, if( selected(${age},β4β), β4β, ββ ) ) ).
A following if is replacing an else part.
Or - as this seems a select_one - yo donβt need selected and could use if( ${age} = β0β, β0β, ifβ¦
Why do you create an extra score, if the values are the same? Or did you put the wrong figures in your example? Different to your text.
If the mapping is such simple, you could just adapt the names/code of the age groups.
Or it could be score =
string( number(coalesce(${age}), β0β)) + 1 )
Maybe you can provide a table how you want to map between age and score.