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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Ifs in CR4.6.1.0

Status
Not open for further replies.

jakob

Technical User
Mar 15, 2001
1
US
How do I end an if statement in CR4.6.1.0?
Here's my dilemma. I want to add a bunch of fields, but some of them are null. So, I need to do something like:
[tt]
if not isnull(field1) then
{
field1 +
}
if not isnull(field2) then
{
field2 +
}
...
if not isnull(fieldx) then
{
fieldx +
}
0
[/tt]
BUT, since I can't use the curly c-style brackets to denote the end of an if statement, (and a one liner doesn't work) all the statements after the first untrue if don't get executed because CR thinks i'm trying to nest the ifs...
help me :)
 
While you could do this with nested ifs, a variable is much simpler.

NumberVar Igor := 0
if not isnull({field1}) then
Igor := Igor + {field1};
if not isnull({field2}) then
Igor := Igor + {field2};
if not isnull({field3}) then
Igor := Igor + {field3};
...
if not isnull({fieldx}) then
Igor := Igor + {fieldx};
Igor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top