crystal report - running total field

ashrobo

Well-known member
Joined
Apr 6, 2003
Messages
70
Location
Black Hole
ive generated a running total (DeliveryQty) for my report but i cant get it to display the way i wanted it to.

DeliveryQty = Sum of Quantity of the same item with different PONo

here is the pic of the report that i currently have now..

columns: ItemNo LotNo PartNo PONo Quantity DeliveryQty
[Broken External Image]:http://lyfe.dysorder.org/work/report.gif

for the first row of Item 1, the DeliveryQty (the rightmost row) should display just 20,000, instead of 18,000 and 20,000.

this is what ive designed to get the above image, after reading the MSDN..
[Broken External Image]:http://lyfe.dysorder.org/work/report design copy.gif

all help will be appreciated!

-ashrobo

p/s: hope the pictures are useful..
 
What you need to do is create a formula like so:

Code:
global dblTotal as double

dblTotal = dblTotal + {YourTableNmae. DeliveryQty}

formula=dblTotal

Then place this field on your report instead of the DeliveryQty one
 
thanks hog, ill try that soon (after i clear the mysterious bug that i had introduced when messing around the report) :)
 
Originally posted by hog
What you need to do is create a formula like so:

Code:
global dblTotal as double

dblTotal = dblTotal + {YourTableNmae. DeliveryQty}

formula=dblTotal

Then place this field on your report instead of the DeliveryQty one

this doesnt work, what i got to achieve is to put the total quantity on the first line of the items.

for eg.
ItemNo PONo Quantity DeliveryQty
1 X123 1,000 3,000
X345 2,000
 
Last edited by a moderator:
Just looking back at your original post, it would appear that although you want to sum the delivery qty you have a grouping by item number, which will bring back two records for item 1 with two different po numbers.

Remove the po field from your query as this info is not required as you are only interested in the delivery qtys.

***********
Forget that, just got out of bed and read your post again...doh

The formula way should work fine for what you want to achieve with a running total
 
Originally posted by hog
Just looking back at your original post, it would appear that although you want to sum the delivery qty you have a grouping by item number, which will bring back two records for item 1 with two different po numbers.
yes, this is what i want to do.


Remove the po field from your query as this info is not required as you are only interested in the delivery qtys.
*forgetting about the above*


The formula way should work fine for what you want to achieve with a running total
what i want to do is to get a total for the individual items with different po numbers.

-ashrobo
 
Yes I understand you.

OK if you have two rows returned for example and you want to see a running total then the formula field approach I mentioned earlier will work.
 
the formula field approach gives me the running total without any resetting for different items. or did i use the wrong word "running total" here? its just the total for individual items..
 
OK, if you want the running total to be specific to each new item group include another global variable in the formula to store the previous items id. On the next call check that the item ids still match, if they dont reset the dblValue to 0 to start a new running total.
 
Originally posted by hog
OK, if you want the running total to be specific to each new item group include another global variable in the formula to store the previous items id. On the next call check that the item ids still match, if they dont reset the dblValue to 0 to start a new running total.
thats what i thought of too, but i dont know how to store the previous item id and thought it might not even be possible in CR. any clues?

million thanks.. :)
-ashrobo
 
Try this:

Code:
Global dblTotal As Double
Global intPreviousID as Number

If intPreviousID <> {YourTableNmae. itemID} Then

   intPreviousID = {YourTableNmae. itemID}
   dblTotal = 0

Else

   dblTotal = dblTotal + {YourTableNmae. DeliveryQty}

End If

formula=dblTotal
 
Back
Top