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

Running Totals

Status
Not open for further replies.

victora

Programmer
Feb 11, 2002
118
US
Hello everybody,
I need help. I have a simple report that prints a Check Register. I created a running totals for count and its dollar amount for:
All Checks 999 $9999.00
Voided 999 $9999.00
Cleared 999 $9999.00

Outstanding: 999 $9999.00

I accumulated Voided based on a flag. Cleared has its own flag. Then I have a formula to calculate the outstanding count and the equivalent $ amount.
Here's the weird part: When I get a non-zero on $Voided and $Cleared, the outstanding dollar comes out correct. When either Voided$ or Cleared$ is zero, then my outstanding$ prints blank (not even a 0 will print). But my count will calculate okay on both situation.

What am I missing here?

thank you in advance

victora


 
It probably isn't zero, it's null, so if you add 1+null you get null.

Since you didn't share the formula, this is speculation.

Try:

File->Report Options->Convert Null Value to Default

This may resolve, otehrwise share some specifics about the formula you're using.

-k kai@informeddatadecisions.com
 
Victoria,

The formula for computing the Outstanding value should begin something like this:

[tt]Local numberVar Voided;
Local numberVar Cleared;

.
. // Other initialization as needed.
.

if IsNull(#Voided) then // #Voided is a running total field
Voided := 0.0
else
Voided := #Voided;

if IsNull(#Cleared) then
Cleared := 0.0
else
Cleared := #Cleared;

// Now do something with the newly defined variables.[/tt]

This formula assumes at least CR 7.0, I don't know if it will work with earlier versions.

It will take the running total results, which is a null value if it does not process any records, and moves the result into a working variable. If the RT is null it sets the working variable to zero. Once the working variables have been properly loaded the rest is easy.

Dan

 
okay, i checked the option 'convert null value to default' but it didnt work.

The weird thing here is, the amount RT has the same condition with my count RT. And its working even i have a zero (or null) count; my formula for outstanding count works fine. The only difference between the count RT and amount RT is 'count' and 'sum' respectively...

i will try next Dan's suggestion
 
I don't think convert null value to default does the same thing in this case. I seem to think that convert null value to default works during data reading and this happens much later, during pass 3 I think.
 
Hi Dan,
I tried your approached which to me, make sense. I created a formula for my Outstanding$ and I got this error "This date time literal was not understood"

here it is in whole:

Local numberVar Voided;
Local numberVar Cleared;


if IsNull(#VoidedAmt) then // #VoidedAmt is a running total field
Voided := 0.0
else
Voided := #VoidedAmt;

if IsNull(#ClearedAmt) then
Cleared := 0.0
else
Cleared := #ClearedAmt;


{#ListedAmount} - Voided - Cleared


Again, take note that on my Outtanding count, it works fine even for zero/null Voided RT or Cleared RT. Why count RT works and not Sum RT?

thanks

VA
 
I think that the problem may be with the running total {#ListedAmount}. (I assume that this is a running total that has been declared in the report.) If it is never initialized, given a value, it will also be null. You will need to include a segment of code in the formula to declare a variable for this value and then test it for null like we did for {#VoidedAmt} and {#ClearedAmt}
 
thanks Dan. I initialized my variables to 0 and my calculation came out correct. I appreciate all your help...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top