Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help With Summary Exclusions Post Reply Post New Topic
Page  of 2 Next >>
Author Message
bmccarthy
Newbie
Newbie


Joined: 19 Aug 2011
Location: United States
Online Status: Offline
Posts: 6
Quote bmccarthy Replybullet Topic: Help With Summary Exclusions
     Posted: 19 Aug 2011 at 7:51am

I have a very detailed report (created about 5 years ago by a programmer) that details the sales representatives accounts and their commission. There are 4 groups, each having data in the header and footer. Currently, the group 1 footer just has a total at the end, showing all commissions for the entire company.

I am trying to build a Summary total of all of the records, but I want it to exclude the total of the sales reps who are no longer with the company. I have found a way to exclude the records completly, but that is not what I want. I still want the report to show as a record with all of the data, just not include it in the summary.
 
I am assuming that I won't be able to use the traditional summary function and will have to build and if/then/else statement, but all the ones I try are not working.
 
This is what I need in laymens terms:
If 'Name' = 'Dave', exclude from sum total
 
Or even if I can make a field that just pulls "Dave's" total to the group footer, then I can build a subtraction formula from there, right?
 
Someone help. I am no genuis Crystal user (obviously) :)
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 22 Aug 2011 at 2:53am
you can use running totals, I would think, but that is DBlank's forte.
 
I use variables, which accomplish the same thing, just with more work.
 
What I would do is build a string of salespersons who are no longer with the company (either by name or id or some other field) like "|Dave|Steve|".  For paranoia, I would put the delimiter at the beginning and end of the string (so NOT Dave|Steve).
 
since this is going to be for the entire report, we don't need a reset formula, but you need to set the 'bad' salepersons, so in the report header section I would do something like this:
shared stringvar badEmp := "|Dave|Steve|";
""   //hides the output
 
increment formula
shared numbervar aTotal;
shared stringvar badEmp;  //your delimited string
if instr(badEmp, {table.employee}) = 0 then
  aTotal := aTotal + {table.fieldToSummarize};
 
""//hide the running total
 
finally in the group you want to display the summary
shared numbervar aTotal;
aTotal
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Aug 2011 at 4:29am
RT version
name= ExcludingNames
field to sumamrize=amount field
type of summary= sum
evaluate =  use a formula
NOt(table.name in ('Steve','John', 'whatever...'))
although I am guessing you have a field that shows if a worker is active so you can use that instead
table.activefield=TRUE
reset = never for report total
place in report footer
 
 
Also if you have no duplicate records you can use one formula to convert your values and use traditional sums on that.
if table.active = TRUE then value field else 0
IP IP Logged
bmccarthy
Newbie
Newbie


Joined: 19 Aug 2011
Location: United States
Online Status: Offline
Posts: 6
Quote bmccarthy Replybullet Posted: 22 Aug 2011 at 10:40am
I would need a solution that allows me to input the "exlusion" formula in the Group footer, not the report footer.
 
Here's a breakdown of how my reports are:
 
Sales Teams (group 1)
Sales Reps withint Sales Teams (group 2)
Breakdown of commissions(group 3 & 4)
 
So, in the Group 1 footer, for each team I would need to be able to exclude Dave from Sales Team A's totals, but still display his commissions as if he were not excluded from the total.
 
Please provide clear instructions as to how I implement this change. (Your previous post is greek to me and I don't know if I put that as a formula, expert, or what).
Thanks! :)
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Aug 2011 at 3:41am
in the Report Field Explorer there is a section called "Running Total Fields"
Right click on it and select New
 
name= ExcludingNames (or whatever you want to call this)
field to sumamrize=amount field
type of summary= sum
evaluate =  use a formula
NOt(table.name in ('Steve','John', 'whatever...'))
reset = on change of group, select group 1
place in group footer 1
 


Edited by DBlank - 23 Aug 2011 at 3:41am
IP IP Logged
bmccarthy
Newbie
Newbie


Joined: 19 Aug 2011
Location: United States
Online Status: Offline
Posts: 6
Quote bmccarthy Replybullet Posted: 23 Aug 2011 at 5:36am
Yay! That worked. However, I have a little problem.
 
With this formula
NOt(table.idnumber in ('955','722', '568'))
I get an error message stating that the ")" is missing...when I remove the last two and only try
NOt(table.idnumber in ('955'))
it works fine.
 
Any ideas?
 
 
 
NEVER MIND, I got it to work but just repeating the forumla and adding the boolean "and" inbetween.


Edited by bmccarthy - 23 Aug 2011 at 5:53am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Aug 2011 at 5:53am
sorry, usinga little sql (parenthesis) in the crystal which uses brackets [] ...
NOt(table.idnumber in ['955','722', '568'])
 
IP IP Logged
bmccarthy
Newbie
Newbie


Joined: 19 Aug 2011
Location: United States
Online Status: Offline
Posts: 6
Quote bmccarthy Replybullet Posted: 23 Aug 2011 at 6:02am
One more thing. For one of the old sales guys, he was the only one on his time, so the running total shows as blank instead of a 0 (zero).
 
Do you know how I can make the running total for his team/group show at 0 instead of blank?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Aug 2011 at 6:08am
maybe this...
in the formula for the RT there is a pick list option that is likely currently set to 'Exceptions For Nulls'. Change it to 'Default Values for Nulls'.
Did that correct it?
IP IP Logged
bmccarthy
Newbie
Newbie


Joined: 19 Aug 2011
Location: United States
Online Status: Offline
Posts: 6
Quote bmccarthy Replybullet Posted: 23 Aug 2011 at 6:14am
Changed it and it still shows as blank. :(
 
Any other ideas?
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