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

Returning Null 1

Status
Not open for further replies.

oradba101

MIS
Feb 28, 2003
318
US
I am using Crystal XI.

I have a formula that returns 0 if there isn't any value. How would I get it to return NULL?

Regards,


William Chadbourne
Programmer/Analyst
 
Please post your formula. Also, make sure your report options has the convert nulls to default is unchecked.
 
Hi, kskid


WhilePrintingRecords ;

NumberVar x5 ;

If {@ppbv} <= {@x5} Then
x5 := x5 + 1;

Regards,


William Chadbourne
Programmer/Analyst
 
Open and save a new formula {@null} without entering anything. Then change your formula to:

WhilePrintingRecords ;
NumberVar x5 ;

If {@ppbv} <= {@x5} Then
x5 := x5 + 1 else
x5 := tonumber({@null});

-LB
 
If the formula is coming up with Zero, then the best you can do is assign it a value of ''.

I may be wrong on this but in Crystal, '' is not the same as NULL.
 
Although you can create a new "@null" formula for the else clause to "force" a nullreturn, the if statement naturally returns null if you simply don't include an "else" clause.

So, your statement would be:

If {@ppbv} <= {@x5} Then
x5 := x5 + 1;

If @ppbv turns out to be >@x5, the above would naturally return null.
 
Wait!!!!

Disregard my previous post. It does return a value other than null.

Use lbass's post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top