Hello all! I am in need of help with understanding how to create a nested if statement. I have 3 statements:
if(${FIA1_Pass} = 'Pass','<font color="green">Pass</font>','')
if(${FIA1_Incorrect_Calc} >= 4,'<font color="red">Fail</font>','')
if(string-length(${Firm_Name_FIA1})=0, 'Incomplete','')
Currently I have them all in 1 calculation using the "or" function, and it works as I would expect in connect, however in my dashboard it appears as "true" or "false." I'm assuming I need to nest my if statement, correct?
Thank you for any help!
You've posted in the Survey123 space, but it sounds like you're trying to use this expression in Dashboards in some way? Can you clarify how you're trying to implement this expression?
Hi Josh,
I'm using it in my XLS.
In XLS, the general practice is to nest additional conditions in the last parameter of the preceding condition. The order matters, so make sure the most important condition is checked first.
if(condition, 'result', if(condition2, 'result2', if(condition3, 'result3', '')))
Using "or" is going to return a boolean, which is why you see true / false.
This was very helpful, thank you! I was able to get it working.
Edit: It's partially working. In connect, it functions as expected, however in my dashboard, nothing is displayed.
When choosing the order...
If the first conditions evaluates to true, then the expression stop evaluation at that point correct? So the only way the last expression will be evaluated is if the first two are false? Is that correct?