Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Print Group Totals in Group Header and then Detail Post Reply Post New Topic
Author Message
CRaid
Newbie
Newbie


Joined: 07 Jan 2013
Online Status: Offline
Posts: 13
Quote CRaid Replybullet Topic: Print Group Totals in Group Header and then Detail
    Posted: 02 Jan 2015 at 9:54am
I need to create a report with Group Totals in the Group Heading (e.g. GH1 and GH2). Then I need to display the detail (e.g. Detail).

Is there a way to do this? I'm drawing a blank right now.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Jan 2015 at 4:16am
if you use a summary function value you can display that in the group header. Shared variables and running totals you cannot.
IP IP Logged
CRaid
Newbie
Newbie


Joined: 07 Jan 2013
Online Status: Offline
Posts: 13
Quote CRaid Replybullet Posted: 05 Jan 2015 at 9:26am
I also need to remove a duplicate order number from the Group Header Total.
e.g.
Group 1 = Customer Name
Group 2 = Customer ID
Group 3 = Order#
Group 4 = Order Line

I am trying to get the totals to show in the header, which also prints corresponding invoices. There can be several invoice lines per order line.

If I have a duplicate order#/Line, do not add to running total, but do add the invoice total to its running total. Note: both order and invoice amounts may be different.

For Example:
Order/Line   Order Amount   Invoice/Line   Invoice Amount
26705/1        353.88        12187/1        244.32
26705/1        353.88        12187/2        176.94
26705/2           0.00        12187/3          0.00

Do not accumulate the 2nd 353.88 to the order total.
DO accumulate the 1st & 2nd lines of the invoice.

How do I get the correct total to show up in the Header for Group 3?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Jan 2015 at 9:31am
if there is only one order amount allowed per gropu 3 then insert a max of order amount into the header.
Hopefully you are only concerend about displaying data not trying to manipulte it so you can do easy math from the way it looks. That is a report trap. Try to not confuse how you decide to display with how you could calculate summaries. Two different things.
IP IP Logged
CRaid
Newbie
Newbie


Joined: 07 Jan 2013
Online Status: Offline
Posts: 13
Quote CRaid Replybullet Posted: 05 Jan 2015 at 9:43am
Thanks for the lesson! I will try your suggestions.
IP IP Logged
CRaid
Newbie
Newbie


Joined: 07 Jan 2013
Online Status: Offline
Posts: 13
Quote CRaid Replybullet Posted: 05 Jan 2015 at 10:04am
It only works in GH4. I need to keep the extra order amount from accumulating into GH3, GH2 and GH1.

Is there a way to do this?
IP IP Logged
CRaid
Newbie
Newbie


Joined: 07 Jan 2013
Online Status: Offline
Posts: 13
Quote CRaid Replybullet Posted: 05 Jan 2015 at 11:22am
Unable to attach report sample. I would like you to see real examples.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Jan 2015 at 11:45am
as a general caution here:
I would be especially careful about your grouping at levels 1 and level 2.
Your description indicates this data is rolling up to a "unique customer" but you have it set to allow for 2 customers with the same name to roll into one summarization.
I assume you are only doing this so for sorting or dsiplay purposes. There are better ways to tdo this. one is simply concatenating the name and ID and grouping on that result. This also removes one level of duplicate grouping.
 
Onto your other issue:
From your description I think you are going to have to run sub reports which I do not like to do. They introduce complexities and more overhead on the the overall process, however, there is really no way within crystal to get a unique SUM of an Order Amount for all of a client's orders into a header when the data has it repeating in the detail section.
If at all possible consider  putting that dat ain footers instead of headers. They are pretty simple to obtain in that section.
The other solution is using a stored procedure (or its equivalent) as your data source and getting the summarized values in the sp before even getting it into crystal. Then you can drop the fields into the respective headers to display.
You might also consider the sub report option in reverse.
By that I mean if you duplicate data rows are coming from a table join to get the details to display (invoce data) then consider using a subreport to display that data and not joining it into your main report data set.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.