Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Groups RTs & Formulas Help Needed Post Reply Post New Topic
Author Message
Pete_B
Newbie
Newbie


Joined: 23 Apr 2012
Online Status: Offline
Posts: 4
Quote Pete_B Replybullet Topic: Groups RTs & Formulas Help Needed
     Posted: 23 Apr 2012 at 3:36am
Hi All

I am a reltive newcomer to CR but haev been using SQl Reporting Server & Excel for a number of years.

I have date similar to the following table:-

SALESMAN TYPE HEADER VALUE YEAR MONTH DAY
Salesman1 Quote 1 5 12 2 1
Salesman 1 Order 0 7.5 12 2 2
Salesman2 Quote 1 5 12 2 3
Salesman2 Quote 1 10 12 3 5
Salesman1 Order 1 10 12 3 6
Salesman 1 Order 1 11.25 12 3 8
Salesman2 Quote 0 12.5 12 3 9
Salesman2 Order 0 13.75 12 3 11
Salesman1 Quote 1 15 12 3 12

Where 1 on the header field indicates a new entry and 0 indicates an amendment.

I am trying to figure out if I can create the following style report:-

Saleman Quotes this Month Orders this Month Quotes Last Month Orders Last Month
Saleman1 1 2 1 0
Salesman2 1 0 1 0

The real report is obviously base on a lot mare data and will also look at YTD and Last year data.

I am using CR 2011 and would appreciate any help you could give.

Thanks

Pete


IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 23 Apr 2012 at 8:23am
sure. Running Totals is not my forte...DBlanks is the master.
 
Formulas, I can help with.
They tend to come in sets of 3: reset, increment, display.  I would think that they are similar to SSRS and if you were running a custom variable.
 
reset, usually the group header:
shared numbervar x := 0;
"" //hides the zero output
 
increment, usually in the detail section
shared numbervar x;
 
if someCondition then
  x := x + {table.field};  //usually a table.field, but could be a constant
 
""  //again hides the running total
 
display, usually in the group footer...and for your report, you may put all display in the group footer and suppress the detail section so that you get just 1 record per salesperson.
shared numbervar x;
x
 
just create the formulas, and drop them in the section that you want them to run in.  Formulas will execute even if the section is suppressed, which may not be the case in SSRS, I know it isn't the case in other reporting system that I develop for.
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Apr 2012 at 4:34am
base on your sample data I think you may be headed down an unnecessary direction but if you still want help with RTs I may be able to assist.
However I think a cleaner approach would be
Convert your year,month,day fields into a date field.
Create 2 formula to sum
    //quotes
      if table.type='Quote' then table.header
    //Orders
      if table.type='Order' then table.header
Now you can use a crosstab or whatver to group on the date and do a sum per salesman
IP IP Logged
Pete_B
Newbie
Newbie


Joined: 23 Apr 2012
Online Status: Offline
Posts: 4
Quote Pete_B Replybullet Posted: 25 Apr 2012 at 12:03am
Thanks for these suggestions - I will try them out and let you know.
IP IP Logged
Pete_B
Newbie
Newbie


Joined: 23 Apr 2012
Online Status: Offline
Posts: 4
Quote Pete_B Replybullet Posted: 25 Apr 2012 at 11:01pm

Hi Guys

Thanks for your suggestions and pointers. I decided to follow your advice and go down the crosstab route and used IF...THEN formulas to create fields and then populate the crosstab table. This worked a treat giving me results like this:-




QUOTES
BOOKINGS
Shipped



LCM YTD 2011 LCM YTD 2011 LCM YTD 2011






0 0 0 0 0 2 0 0 2
A CHAMBERLAIN
0 0 63 0 0 75 0 0 75
AHMET GUENDAR
9 71 31 1 8 5 0 7 5
ALEX HORN
0 0 1 1 2 3 0 1 3

However in typical fashion now I have thsi report the managment want other fields adding. The one I am having problem with is number of lines Quoted/Booked/Shipped. I thought of using a formula like this:-

IF {table.year}=YEAR(Maximum(lastfullmonth)) AND {table.type}='Quote' THEN {table.header} (the header is only 1 on the first line of an order all other lines are 0)

I assumed if I used the count function it would work - however it seems to ignore the IF Statement and just does a count of all of the {table.header}. I have tried using other clarifiers such as {table.LineNo}<>0  or using THEN {table.LineNo} and using count but it always gives me the same result. I even added “AND  {table.Salesman}=’Salesman1’” to see if that changed the figure but it didn’t.

I am well and truely baffled about this if you have any suggestions that would be great.

Thanks

Pete
IP IP Logged
Pete_B
Newbie
Newbie


Joined: 23 Apr 2012
Online Status: Offline
Posts: 4
Quote Pete_B Replybullet Posted: 26 Apr 2012 at 12:23am
Ok resolved - I used:-
IF {table.year}=YEAR(Maximum(lastfullmonth)) AND {table.type}='Quote' THEN 1 ELSE 0
So simple in hindsight!!

Thank you for your help.

Pete
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