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

Not NULL and Not 0 1

Status
Not open for further replies.

Crystalfire

Programmer
Jan 29, 2002
315
US
I have a SUM of a formula that I am trying to suppress if the total is 0. When I format the field to suppress if EX: {@SST SCRAP ACCT Total Formula}=0 then the "0" AND the ones with #'s suppress also. I also tried if isnull with the same result. I am using Crystal 8.5.
 
How about:

round(Sum({@SST SCRAP ACCT Total Formula}),0) = 0

//Or,

round(Sum({@SST SCRAP ACCT Total Formula},{table.account}),0) = 0

You would use the second if you are trying to suppress group sums = 0.

-LB
 
You could try using a formula to give nulls a distinct value. E.G.

If isnull({@SST SCRAP ACCT Total Formula}) then "A"
else if {@SST SCRAP ACCT Total Formula} = 0 then "B"
else "C"

Then do a running count for the formula values. Note that any formula stops when it finds a null value, unless null has already been tested for.

Madawc Williams
East Anglia, Great Britain
 
Some technical information would be useful, such as the Crystal version, database, example data and expected output.

And specifically in this case, post your formula, not a description of what you tried in it.

It's very difficult to create a null formula, I would guess that the null check isn't the difficulty.

Since the sum is a number, try right clicking it and selecting format field->Number Tab->Customize->and select suppress if zero

Otherwise consider posting technical information as described.

-k
 
synaps -- I tried your suggestion of "Since the sum is a number, try right clicking it and selecting format field->Number Tab->Customize->and select suppress if zero" and it woeked great. Why then did it not work when I tried to suppress it using the common tab and write a formula of if 0 then -- ? Thanks for your help!
 
Perhaps it wasn't really zero?
But something like 0.000000001?

Just a guess that I sometimes run into.
 
To expand on what befine said, Crystal has a habit of holding infinitessimal values when it does sums. This is because of the way SQL handles numbers, I think. In any case, when I was doing calculations in pounds and pence, I found that I needed to round the figures to two decimal places before they would behave sensibly.

You can put rounding into other calculations, like this:

Code:
if round(({MOR01.Currentbal}/3), 2) > 11.50 
then "Sufficient" 
else "Fails"

Madawc Williams
East Anglia, Great Britain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top