Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Running Total Evaluate Post Reply Post New Topic
Author Message
dallasf
Newbie
Newbie
Avatar

Joined: 11 Apr 2013
Online Status: Offline
Posts: 26
Quote dallasf Replybullet Topic: Running Total Evaluate
     Posted: 17 Jun 2014 at 7:42pm
Hi,

Just writing a salary report for a client. They wish to have a ongoing running total for base salary and have it totalled as it increases.

As you can see the fields below I have the starting salary. Then the increase then the Base Salary which will be my running total.

My issue is how do I add the increase in the running total. I assume its a formula in the evaluate?

Thanks


Date            Start Sal Increase Base Salary
01/12/2003     62,000      0          62,000
01/12/2003                 0           62,000
31/12/2003                 5,000       67,000
31/12/2004                 1,000       68,000
31/12/2005                 5,000       73,000


Edited by dallasf - 17 Jun 2014 at 7:43pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Jun 2014 at 4:17am
I don't understand your question. In the above example what is teh output you want to see?
IP IP Logged
Erik
Groupie
Groupie
Avatar

Joined: 05 Dec 2013
Online Status: Offline
Posts: 50
Quote Erik Replybullet Posted: 18 Jun 2014 at 6:32am
It sounds like you are wanting to have a total of all the salary increases added together, in this case 5,000 + 1,000 + 5,000, as opposed to displaying each individual increase.

You'd want to do something like:

numberVar salaryIncrease := salaryIncrease + (salaryBase - salaryStart);

If the data doesn't carry over, use "global numberVar".
IP IP Logged
dallasf
Newbie
Newbie
Avatar

Joined: 11 Apr 2013
Online Status: Offline
Posts: 26
Quote dallasf Replybullet Posted: 18 Jun 2014 at 12:16pm
Hi,

This bit worked. Thanks

global numberVar salaryIncrease := salaryIncrease + ({@StartingSalary} + {@Increase});

Because my report is grouped by employee, the totals keep calculating for each group, so the calculation continues when it should reset per group. How do I reset this per group?

I read if I do a formula and enter this and place it in the group header it will reset. But it hasn't.

WhilePrintingRecords;
global numberVar salaryIncrease := 0;

Why would this be occurring?


Edited by dallasf - 18 Jun 2014 at 10:13pm
IP IP Logged
Erik
Groupie
Groupie
Avatar

Joined: 05 Dec 2013
Online Status: Offline
Posts: 50
Quote Erik Replybullet Posted: 07 Jul 2014 at 1:59pm
To do summary with respect to group you are on the right track by putting it in the header (or footer). The other thing is that you'll need to modify your formula to pay respect to that grouping.

Using your recent formula as an example, I would change it to:

global numberVar salaryIncrease := sum((salaryIncrease + ({@StartingSalary} + {@Increase})), {@GroupName});

Although I am thinking to calculate your salaryIncrease appropriately you'd want to subtract salaryStart from salaryBase for each iteration.

Example assuming salaryStart is updated each iteration to represent the previous salaryBase:

global numberVar salaryIncrease = sum((salaryIncrease + (salaryBase - salaryStart)), {@GroupName});

Or if your salaryStart is not updating each time, and you are just working with the original number, this simpler version might work:

global numberVar salaryIncrease = sum((salaryBase - salaryStart), {@GroupName});


Edited by Erik - 07 Jul 2014 at 2:00pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Jul 2014 at 3:40am
you can also just create a running total and add it to the base field
 
Running Total
name = IncreaseSum
field to summarize=salary increase
type=sum
evaluate=on each record
reset=on change of group
 
create a formula to add the base value to this running total to get waht you want
 
table.salarybase + #IncreaseSum
 
place this formula field in the detail section
 
if the base value is not carried on each row for some reason use a second RT as the max of that field reset on each group instead of the field itself


Edited by DBlank - 08 Jul 2014 at 3:42am
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