theo
New Member
Posts: 3
|
Post by theo on Sept 16, 2016 12:49:33 GMT -5
I am wondering if it's possible to have nested conditional logic? Here is a test that didn't work...
Group {IF==0001-HSA} DepCount {IF==0} {"Option 1"} {ELSE} {"Option 2"} {ENDIF} {ELSE} {"Option 3"} {ENDIF}
Intended to be equivalent to the following psuedo code
if (Group == "0001-HSA") { if (DepCount == "0") { Print("Option 1") } else { Print("Option 2") } } else { Print("Option 3") }
If it's possible to nest conditional logic, can anyone please explain what is wrong with the above script?
|
|
|
Post by Allan Murray on Sept 17, 2016 0:48:43 GMT -5
You cannot nest if-statements within the same virtual field. But you can add a second virtual field to calculate the result of the nested if-statement.
eg virtual field called 0001-HSA_Result contains: DepCount {IF==0} {"Option 1"} {ELSE} {"Option 2"} {ENDIF}
then the second virtual field (which outputs the final result) contains: Group {IF==0001-HSA} 0001-HSA_Result {ELSE} {"Option 3"} {ENDIF}
You just have to make sure that 0001-HSA_Result is higher up the list of virtual fields than the virtual field that references it.
|
|
theo
New Member
Posts: 3
|
Post by theo on Sept 20, 2016 15:38:51 GMT -5
Thank you Allan
|
|