Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Store RT in variable & calculate changes in % Post Reply Post New Topic
Author Message
Sven
Newbie
Newbie


Joined: 28 Mar 2008
Online Status: Offline
Posts: 12
Quote Sven Replybullet Topic: Store RT in variable & calculate changes in %
     Posted: 28 Mar 2008 at 7:12am

Hello together !!

I am setting up a report (CR XI). The report includes all invoice values of the last two years (2006, 2007). The report has two groups: Group 1# are the years. Group 2# are the product groups.

I have created a running total (RT) with the running total expert. The RT  resets on the goup 1# changes. So fare so easy. Now I want to caputre the RT values in a variable.

So how can I store the RT in a variable?
 
Then I want to display the RT value stored in the variable in the report footer - both values for 2006 and 2007 (I do not want to use a cross tab) And calculate the growth in % between 2006 and 2007.
 
So how can I display both values for the variable (2006 and 2007) in the footer? How can I calculate the difference (%) between the two values?
 
Any ideas?!?! Would be great!! Smile
Sven

 

Keep trying :)
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 28 Mar 2008 at 10:33am
Rather than using the running total expert, you are going to have to do it manually. What you need to do is create two Global variables (one for each year) and use an If statement to assign the proper value to each one (summing it as you go along). Something like this (you'll have to modify it - I'm just typing off the top of my head).
Global NumberVar Total2006;
Global NumberVar Total2007;
if Year({table.datefield}) = 2006 then
    Total2006 := Total2006 + {table.amountfield}
else
    Total2007 := Total2007 + {table.amountfield};

Then in the report footer you can put formulas which print each total or print the differences.
Global NumberVar Total2006;
Global NumberVar Total2007;
(Total2007-Total2006)/Total2006;

I have three chapters covering writing formulas and building manual running totals in my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Sven
Newbie
Newbie


Joined: 28 Mar 2008
Online Status: Offline
Posts: 12
Quote Sven Replybullet Posted: 01 Apr 2008 at 9:17am
Hi Brian
 
thanks for your help!! Unfortunately, it is not working. Here is what I do:
 
1. Creating a formula which contains the Variables & If Statement.
2. Place this formula in the detail section
3. Create a second formula to display the variables in the group footer.
 
If I run the report, there is no value assigned to the variables.
 
The problem might be that the amount, which will be summed in the variable is based on a formula. This formula might be calculated after the values are assigned to the variable?
 
Any ideas?
 
Greetings from England
Sven
Keep trying :)
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