4 years 8 months ago - 4 years 8 months ago #104840
dolly_wen created the topic: about nested if syntax
Hi, I was trying to use nested if statement, something like (these lines work):

{if(Calculation > 32, 'Right Handed',if(Calculation <= 32 && Calculation >=29,'Moderately Right Handed', if(Calculation <= 28 && Calculation >= 25, 'Weakly Right Handed',if(Calculation == 24, 'Ambidextrous', if(Calculation <= 23 && Calculation >=20, 'Weakly Left Handed', if(Calculation <=19 && Calculation >= 16, 'Moderately Left Handed', 'Strongly Left Handed' ) ) ) ) ) )}

I want my expression to span multiple lines (see the following), which is easier to read. I follow the example ( manual.limesurvey.org/Expression_Manager#Conditional_Equations ). I began a new line by pressing "Enter" and "Shift", but it does not work. Can anybody kindly help out?

{if(Calculation > 32,
'Right Handed',
if(Calculation <= 32 && Calculation >=29,
'Moderately Right Handed',
if(Calculation <= 28 && Calculation >= 25,
'Weakly Right Handed',
if(Calculation == 24,
'Ambidextrous',
if(Calculation <= 23 && Calculation >=20,
'Weakly Left Handed',
if(Calculation <=19 && Calculation >= 16, 'Moderately Left Handed',
'Strongly Left Handed'
)
)
)
)
)
)}
Last Edit: 4 years 8 months ago by dolly_wen.