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

CR9: First record shows up null, even though formula sets it = 0 1

Status
Not open for further replies.

JStandard

Programmer
Mar 15, 2005
22
US
Greetings,

Crystal Reports 9 Professional.

I have a data set of Investors and the rates they pay. An investor either pays a 5% fee or a 0% fee (represented usually as a null). Investor fees are stored at two levels, first a check if their fee is stored at Level1, if not, check if it is stored in Level2, if not, then display a 0, using the following formula:

If {feeRates.Investor Incentive Fee} > 0 and not(isnull({feeRates.Investor Incentive Fee})) then
{feeRates.Investor Incentive Fee} * 100
else if {feeRates.LE Incentive Fee} > 0 and not(isnull({feeRates.LE Incentive Fee})) then
{feeRates.LE Incentive Fee} * 100
else
0

This formula works and if there is a null, it displays a 0 for all records in crystal except the first one. So, if there is a null on say record 2 through n records, it will properly display a 0 instead of a null, but, on the first displayed record it displays a blank value.

Ex.

Investor Fee Rate
Inv1
Inv2 0.00%
Inv3 0.00%
Inv4 5.00%
InvN 0.00%

If if "Browse Field Data" the dataset shows up a "0.00, 5.00", which is what it should be, either 0.00 or 5.00.

Does anyone have any thoughts on why the first value would display as blank, even though my formula should basically always display something other than 'blank' or 'null'?

Thanks,

Jeff.
 
Move the Null checking to the beginning of the tests:


If not(isnull({feeRates.Investor Incentive Fee})) and {feeRates.Investor Incentive Fee} > 0 then
{feeRates.Investor Incentive Fee} * 100
else if not(isnull({feeRates.LE Incentive Fee})) and {feeRates.LE Incentive Fee} > 0 then
{feeRates.LE Incentive Fee} * 100
else
0

-dave
 
Dave,

Logically I now see I should make certain the value is not null first, before checking if the value is greater than 0, but why does that make a difference in this case. If a value is null, how would it still pass the second part of the test, the not(isnull()) piece?

It worked by the way, thanks a great deal.

Jeff.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top