Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nested If's

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How can i turn this into crytal syntax?

If x
{
if y
{
a;
}

else b
}
else b
 
Perhaps a real example might help, sounds like your new to Crystal syntax:

if {MyTable.MyField_1} = 100
and
{MyTable.MyField_2} = 300 then
"It's 100 and 300"
else
"It's not 100 and 300"

-k kai@informeddatadecisions.com
 
in some situations, that wont work. For examples NULL's will not give you A or B, the AND will result in a result of NULL.

You can nest ifs logically as you'd expect. And you can use "(" instead of your "{". But you need a "Then"

If x then
if y then a
else b
else b

is valid CR sytax. Spaces and indenting are optional but help to see what is going on.

If x then if y then a else b else b

is the same formula but is a lot harder to follow.
Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top