Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Help with calculations on summary report Post Reply Post New Topic
Author Message
ResidentSD
Newbie
Newbie
Avatar

Joined: 07 Jun 2011
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote ResidentSD Replybullet Topic: Help with calculations on summary report
    Posted: 07 Jun 2011 at 10:58pm
Hello there. I am relatively new to Crystal Reports 2008 which we recently purchased, so I hope someone can help me with a little problem I'm having.

I have a report written that shows a list of customers which the company I work for has sold to and against them it shows summary data relating to material we've sold to them, such as weight and net amount. There are then two columns for gross margin and gross margin per tonne.

The report is set out with each item sold being taken from a database table and the weight and net amount are included in each detail line. The margin is a calculation that involved using a subreport to get some additional data from other tables and related references etc. These are then totalled in a group footer. All this works absolutely fine.

The problem is that this is supposed to be a summary report, and the management don't want to see line by line details - they just want to see the summary/group footer line for what we've actually sold to the customer. If I suppress showing the detail section, the weight and net amount columns total fine (because of them coming directly from the database) but my margin calculation is wrong, because the subreport is suppressed, therefore it doesn't run.

I've tried a few different things, but I can't see a way to make it so the detail is suppressed but I still get the data I need. Is there an easy way I'm missing, or can someone suggest another way I can do the report to get the right result?

Thanks for your help!

FYI - I'm using Crystal Reports 2008 v12.3.0.601 on Windows 7 Professional 32-bit with Service Pack 1. The data being used is stored in a MySQL 4.0.12 database and is being connected to using the MySQL/ODBC Connector 3.51.
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 08 Jun 2011 at 3:06am
What is preventing you from nixing the subreport all together? Is the linked value being suppressed between the two reports?
IP IP Logged
yggdrasil
Senior Member
Senior Member
Avatar

Joined: 19 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 150
Quote yggdrasil Replybullet Posted: 08 Jun 2011 at 3:07am
That sounds like the problem I had a long time ago, and I asked here. This is the reply I got from Brian then and have kept ever since Smile:
 
I have a couple thoughts, but it seems like you guys already tried them? First off, subreports are
always calculated last in a section. So they will always return zero in the section they are printed in.
 No way around that. Now, Dreamcatcher said that he created a second footer section and put the
subreport there. I'm assuming you put the subreport, and ONLY THE SUBREPORT, in Footer Section A?
Always keep the subreport in its own section with nothing else in it. If you put it in section B
then it will be called last and not work for you.
Now, if you did all that and it doesn't work (which is should work, but maybe something else is
going wrong...) then you can put the subreport in the Detail section and suppress it. I wrote
about how to do this in Tutorial 9-6  of my CR Encylopedia book.
1. After making sure that the subreport formula works (and you get tons of blank space), add
it to ITS OWN SECTION (very important) in the main report.
2. Then go into the subreport and set EVERY section to be Suppressed. This disables printing
the sections but the formulas will still be calculated. Test to make sure it is blank.
3. Then on the main report right-click on the subreport and select Format Subreport. Click
on the Subreport tab and click the option Suppress Blank Subreport. This hides the subreport
when every section is suppressed. Save your changes.
4. On the main report, right-click on the gray area to the left of the section that has the
subreport and choose Section Expert. Click the option Suppress Blank Section. Save your changes.
This will keep the subreport from printing, but its calculations are still run.
That should do it! I tested this pretty well prior to writing about it and it works like a charm.
IP IP Logged
ResidentSD
Newbie
Newbie
Avatar

Joined: 07 Jun 2011
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote ResidentSD Replybullet Posted: 08 Jun 2011 at 4:17am
Originally posted by yggdrasil

That sounds like the problem I had a long time ago, and I asked here. This is the reply I got from Brian then and have kept ever since Smile:
 
I have a couple thoughts, but it seems like you guys already tried them? First off, subreports are
always calculated last in a section. So they will always return zero in the section they are printed in.
 No way around that. Now, Dreamcatcher said that he created a second footer section and put the
subreport there. I'm assuming you put the subreport, and ONLY THE SUBREPORT, in Footer Section A?
Always keep the subreport in its own section with nothing else in it. If you put it in section B
then it will be called last and not work for you.
Now, if you did all that and it doesn't work (which is should work, but maybe something else is
going wrong...) then you can put the subreport in the Detail section and suppress it. I wrote
about how to do this in Tutorial 9-6  of my CR Encylopedia book.
1. After making sure that the subreport formula works (and you get tons of blank space), add
it to ITS OWN SECTION (very important) in the main report.
2. Then go into the subreport and set EVERY section to be Suppressed. This disables printing
the sections but the formulas will still be calculated. Test to make sure it is blank.
3. Then on the main report right-click on the subreport and select Format Subreport. Click
on the Subreport tab and click the option Suppress Blank Subreport. This hides the subreport
when every section is suppressed. Save your changes.
4. On the main report, right-click on the gray area to the left of the section that has the
subreport and choose Section Expert. Click the option Suppress Blank Section. Save your changes.
This will keep the subreport from printing, but its calculations are still run.
That should do it! I tested this pretty well prior to writing about it and it works like a charm.

I actually saw that reply earlier on and it looked very familiar to what I'd learnt previously about the processing of subreports. I wrongly assumed that because of this, my problem was different because of the subreport being in the detail band which the results of it being in the group footer band. However, the 'Suppress Blank Subreport' flag in the Subreport tab on the Subreport was the key thing I'd missed, and (with some other tweaks) my report now works fine.

Many thanks!


Edited by ResidentSD - 08 Jun 2011 at 4:19am
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.047 seconds.