Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: What am I missing??? Running total Post Reply Post New Topic
Author Message
rdseal
Newbie
Newbie
Avatar

Joined: 18 Jun 2009
Online Status: Offline
Posts: 23
Quote rdseal Replybullet Topic: What am I missing??? Running total
     Posted: 23 Jun 2009 at 5:56am
Hi all,

I have successfully created a report and started configuring my data for some logical and easy to view way.
I am stuck... My idea is to create an invoice that showing everything we want.
I have:
{product description}-table field
{pack description}-table field
{units per case}-table field
{price per case}-table field
{total price per line}-formula:{@TOTCASECOST}+{@TOTBTLCOST}
where {@TOTCASECOST} is - "IF {@QCASES} > 0 THEN ({CERotation1.CostValue}*{#TOTCASES}) ELSE 0".
and {@TOTBTLCOST} is - "IF {@QBTLS} > 0 THEN {CERotation1.CostValue}/{CERotation1.BottlesPerCase}*{#TOTBTL} ELSE 0"
{cases}
{units}

and all I want is running total for {total price per line} to summarise the invoice.
Problem is that when I am trying to create Running total there is no "TOTALCOST" formula field to choose from???

Please help!!! What am I missing???

Thanks in advance

read read read
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 23 Jun 2009 at 6:09am
You might be able to use a Running Total, if so DBlank is sure to respond.  My solution is, usually, and definitely in this case shared variables.  Depending on how your report is structured, ie how many groups you have and how often you want the total to display will determine some of these instructions but in general the formulas for shared variables works in groups of 3.
1) in the group header to set the variable = 0
2) in the details section to increment the variable (in your case something like:
shared numbervar totInvoice := totInvoice + TotalCost;
3) in the group footer to display the variable.
 
shared variables are pretty easy to use and there are lots of posts regarding this procedure.
 
HTH
IP IP Logged
rdseal
Newbie
Newbie
Avatar

Joined: 18 Jun 2009
Online Status: Offline
Posts: 23
Quote rdseal Replybullet Posted: 23 Jun 2009 at 6:32am
Thanks lockwelle, I don't know much about variables and I will need some help on that.
I have 3 groups
Where can I change variable? Section Expert>?
read read read
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 23 Jun 2009 at 6:54am
shared variables are set through formulas.  They are really easy to set up and access.
to declare them/access them/set them up....shared (type of variable) (name).  Now you can use the variable in your formula just like a table.field.  Search Crystal Help for the types of variables (there are quite a few, though I don't use but a couple).  The examples there and just about any of my posts will give more clues.
 
Shared variables are really useful, you can use them for running totals, as switches for suppression, to change colors, really anything. 

HTH
IP IP Logged
rdseal
Newbie
Newbie
Avatar

Joined: 18 Jun 2009
Online Status: Offline
Posts: 23
Quote rdseal Replybullet Posted: 23 Jun 2009 at 7:00am
Sounds easy I will have to read more about it...
read read read
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Jun 2009 at 7:06am
It is hard to tell if you can use a RT here as you have a couple of undefined formulas and 2 other RT's that are being used in the formulas.
Generally the symptom of a formula not appearing for use is that that formula is using a function that cannot be used again in another formula, (Like a  SUM of a SUM).
So my guess here is that you are creating a value that can be displayed at one of your group (e.g. GF2) that is summarizing data and now you are trying to sum that to display on another group (e.g. GF1). The solution (if you go with RT or Variables) will mean you need to create a seperate RT that gives you values at the next group level independent of the other RT.
 
Make sense?
IP IP Logged
rdseal
Newbie
Newbie
Avatar

Joined: 18 Jun 2009
Online Status: Offline
Posts: 23
Quote rdseal Replybullet Posted: 23 Jun 2009 at 7:12am
It dose. What I am thinking is that I will try simplify my report a bit. I think I can get rid of 2 out of 3 groups and see if it helps.

Thanks
read read read
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Jun 2009 at 7:32am
I do not think you need to remove group levels. Just rethink how you get the numbers at each group level. If you know going in that you can't add the totals from group2 to give you a total for group 1 then you will approach the math differently.
Usually it just means making 1 or 2 more RT and a new formula to sum those at the next group level.
Use distinctcounting as a way to think about this. Say you have
Field 1
A
A
A
B
B
and you group on the AB field.
You can do a RT as a distinctcount of the field reset at Group1. Place it on GF1 and that will give you a 1 for each footer. Legally you cannot create a formula to add that RT together to give you the grand total of 2. Instead you make a new RT as a distinctcount of that field as reset never and place it on the Report footer and you get 2. Same result different approach.
IP IP Logged
rdseal
Newbie
Newbie
Avatar

Joined: 18 Jun 2009
Online Status: Offline
Posts: 23
Quote rdseal Replybullet Posted: 23 Jun 2009 at 7:54am
Well, I can picture it in my head but I will have to rethink my approach...

Thanks again

Will post when I am done.
read read read
IP IP Logged
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