I want to nest if-else statements in Crystal Reports, but I don't know the necessary syntax. How can I arrange something like this:
if table1.id <> "1" then
if table1.name <> "a" then
var1 := "Hello"
else
var1 := "Hi"
else
var1 := "Bye"
Nested if statements A nested if statement is an if statement placed inside another if statement. Nested if statements are often used when you must test a combination of conditions before deciding on the proper action.
You can use parenthesises to avoid ambiguity within nested if..else
structures:
if {table1.id} <> 1 then
(if {table1.name} <> "a" then
var1 := "Hello"
else
var1 := "Hi";)
else
var1 := "Bye";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With