Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Totals in whileprinting data Post Reply Post New Topic
Page  of 2 Next >>
Author Message
wizarduser
Newbie
Newbie


Joined: 22 Jun 2011
Location: United States
Online Status: Offline
Posts: 10
Quote wizarduser Replybullet Topic: Totals in whileprinting data
     Posted: 25 Jul 2011 at 6:58am
This might sound a little convoluted or mixed up, but here goes.
I am reading an inventory transaction file in reverse order to get costs of currwnt inventory.  My groups are:
warehouse
partid
location
 
I am trying to isolate inventory from 1 warehouse.  I have to evaluate by location since it is a FIFO inventory and can can not just use the dates of trans by the warehouse.  (tried that and get wrong results since inventory is going in and out.)
 
I am resetting my totals between locations, after adding them to a part total on whileprintingrecords. 
My problem is that the totals sem to pickup the last suntotal 2 times.  If i have 12 peices in 1 location, and 35 in the next, the total being displayed is 59 (12+12+35) not 47 (12+35).  I am adding to the total only when the display quantity is greater than zero.
 
I hope this is clear.
 
Thank you 
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 25 Jul 2011 at 7:56am
are you using manual running totals?
sharona
IP IP Logged
wizarduser
Newbie
Newbie


Joined: 22 Jun 2011
Location: United States
Online Status: Offline
Posts: 10
Quote wizarduser Replybullet Posted: 26 Jul 2011 at 2:42am
Yes.  these are calculated figures I am totaling.  So running total fields will not work.  nor will summary fields.
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 26 Jul 2011 at 3:17am
Without seeing your data or your formula, it would be hard to pin-point exactly where the bug is.

Perhaps you can display the running total on the side for each record and then look at how it's adding the last subtotal twice.

Sounds like a logic error in the formula. Or formulas.

Edited by Keikoku - 26 Jul 2011 at 3:18am
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 26 Jul 2011 at 3:19am
where are they calcualted from a stored procedure?
sharona
IP IP Logged
wizarduser
Newbie
Newbie


Joined: 22 Jun 2011
Location: United States
Online Status: Offline
Posts: 10
Quote wizarduser Replybullet Posted: 26 Jul 2011 at 5:01am
They are being calculated in the formula fields.  Look at the reply abive to see how thet are being caculated .  or i will write it 2 times:
 
whileprintingrecords;
shared numbervar totalcp;
if {@totqp} > 0 then
totalcp:=totalcp + {@ccost}
 
I am saying if the field totalqp which is the quantity print line is > 0 then add to the total the ccost which is a calculation of total cost per piece * number of peices in inventory.
 
IP IP Logged
wizarduser
Newbie
Newbie


Joined: 22 Jun 2011
Location: United States
Online Status: Offline
Posts: 10
Quote wizarduser Replybullet Posted: 26 Jul 2011 at 5:02am
They are being calculated in the formula fields.  Look at the reply abive to see how thet are being caculated .  or i will write it 2 times:
 
whileprintingrecords;
shared numbervar totalcp;
if {@totqp} > 0 then
totalcp:=totalcp + {@ccost}
 
I am saying if the field totalqp which is the quantity print line is > 0 then add to the total the ccost which is a calculation of total cost per piece * number of peices in inventory.
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 26 Jul 2011 at 7:11am
i think you need a reset formula for your shared variable,
is this value coming from a sub report?
if so you may want to make sure it is below the sub to pull the correct value
sharona
IP IP Logged
wizarduser
Newbie
Newbie


Joined: 22 Jun 2011
Location: United States
Online Status: Offline
Posts: 10
Quote wizarduser Replybullet Posted: 26 Jul 2011 at 8:22am
no not a sub report.  just trying to total some detail lines that were calculated.  I do not want to lose the data bt resetting until the next part number is found.
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 26 Jul 2011 at 9:16am
i think your problem is in the sharednumbervar
that is generally used to pull data from a sub and share it in the main.
sharona
IP IP Logged
Page  of 2 Next >>
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum