If-statement not working as hoped


I am trying to create an if-statement to show the main partner based on the selected local partner, however, I keep ending up with a same main partner. The statement I am using is:

if((${partner}=a),‘conA’, if ((${partner}=b or ${partner}=c or ${partner}=d or ${partner}=e), ‘conB’, if ((${partner}=f or ${partner}=g or ${partner}=h),‘conC’,’ ')))


Do you have any suggestions on how to edit the if-statement to show what I need?
Thank you!

selects are stored as strings, so you need to compare always to strings, i.e. if( (${partner}=‘a’), …
Or with … = “b” (with double quotation marks)

Otherwise, you will get another behaviour:, as you have seen:
${partner} = b >> evaluates to >> false
as ‘b’ != b. There seems to be no automatic cast here!
( ${partner} = b) or (${partner} = c ) >> evaluates to >> true
as ( false() or false() ) >> evaluates to true.

Hint: For complex/cascading if structures, better develop and test step-by-step.

Another solution for your aggregation requirement would be to define the mapping (instead of with your if) through an additional “look-up” column in the choices. See Form Datasets - ODK Docs.