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!

Formulas dont work with Running Totals that Sum and return nothing 1

Status
Not open for further replies.

WhiteKnight2K

Technical User
Dec 30, 2002
26
0
0
CA
Hello there!

The problem I am having (and I hope there is a work around to this) is that sometimes my running total that is set to Sum will not return anything (i guess it returns NULL) so when I try to use this running total in a formula such as where i subtract or add this running total to another running total that does not return NULL, the result of the formula is a blank. I find it crazy that I cant use my running totals that sum in a formula if one of the running totals returns a NULL. Is there any way around this other than using a series of if...then...elses?

Thanks!
 
Perhaps if you create a formula as in:

if isnull({#rt}) then
0
else
{#rt}

I just checked a RT here and it did NOT return a null, it returned a 0.

Perhaps if you turn on the File-Repirt Options->Convert Null Value to Default it might help, it may be that what is being summed is null, not that it doesn't exist, not sure though, I do recall having a similar problem before.

-k kai@informeddatadecisions.com
 
WhiteKnight,

Does your RT have an evaluate formula? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
I found that in Cr8/8.5 the running total is NULL if the condition selects no records.

CR9 has an option to turn those fields into 0, but if you are stuck with a prior version here is the formula I used to add up three running totals where some of them might be null;

numbervar t:=0;
if not isnull({#total1} then t:=t+{#total1};
if not isnull({#total2} then t:=t+{#total2};
if not isnull({#total3} then t:=t+{#total3};
t

Messy, but it works well. Editor and Publisher of Crystal Clear
 
Heh, well Chelseatech, I did it the way you have suggested before I received your reply, and it worked but it WAS really messy....i wonder if synapsevampire's way works too...it would look much neater =o)

btw, does CR9 allow for nested subreports b/c I've run into another problem that i would be able to solve with nested subreports....and I dont know how to make a stored procedure that uses SQL to select a record
 
CR 9 doesn't allow nested subreports. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top