Crystal reports: how to conditionally suppress sections - crystal-reports

I am having difficulty suppressing a group header if another group header is blank/suppressed.
Originally I had a layout as follows:
Group Header a - contains client details
Group Header b - contains a subreport that showed details of the incoming calls from client that were received in the last 24 hours.
If the sub report in group header b was blank (because no calls had been received in the last 24 hours), my report was still showing the client details in group header a.
I can suppress the group header b section if the subreport is blank, but cannot work out how to suppress group header a if group header b is blank/suppressed.
After reading various other discussions, I understood that if you want to suppress a section when a subreport is blank, then the subreport would need to be in a section before the section you want to suppress.
So, I changed my layout as follows:
Group Header a - contains sub report showing details of calls in last 24 hours (sub report is suppressed if blank, and group header a is suppressed if blank)
Group Header b - contains client details
Group Header c - contains same subreport showing calls received in last 24 hours
So what I now need to work out is, how do I suppress group header b and c if group header a is suppressed?!
Any help would be greatfully received.

You will need to check record count of sub report, if it is zero then suppress the group using conditional suppress formula. So basically in your group query somewhere you must have field which keeps the count of records in sub report.
Right Click on section
Section Expert
Suppress No Drill
Click x-2 formula editor
if {count} = 0 then true else false
Where {count} is the field having total records for that group
Hope this helps you!

Related

Crystal Reports Suppress On Zero

I have a summary reports that looks at all stock items, available sizes, sales and transactions.
The report consists
Stock Reference
Weight (ton,load, net etc)
Sub report containing transaction data
All the items are in a group header within the main report.
I wanted to be able to hide the header if an item from the sub report was Zero.
I set up a shared variable which passes the quantity from the sub report to the main report, however this is not processed until the group header is displayed.
To compensate i duplicated everything in the group header and placed it in the group footer (including the shared variable form the sub report).
My thinking was that i could suppress the group header permanently and the group footer conditionally if the shared variable is 0 (if {#SharedQuantity} = 0 then true).
Currently if i suppress the group header the whole report is blank. If i dont suppress the header the footer acts correctly, suppressing rows on items that dont have a quantity.
I assumed that suppressing items still meant that they where processed and hence the shared variable would still be set.
The answer to the above was to suppress all the fields within the sub report in the group header, then setting the group header as suppress if blank. This way the shared variable was still populated and the conditional suppress on the group footer worked as expected.

Repeat group header even after footer bleeds over

My group header is set to repeat on each new page. My details section follows it and the group footer has a subreport. On some pages, the subreport flows onto the next page - so the group header will not display before the rest of the subreport.
How can I display the group header even after a subreport break?
You can do this if you use two groups and place your subreport into the group footer of the second group.
Create a second group (for the same field as used in group one)
Configure group header 1 so that it will be repeated on every page (in group assistent, i don't know the english option name)
use group header 1, suppress group header 2
put the subreport in group footer 2, suppress group header 1
If you subreport bleeds over (in group footer two) group header 1 will be repeated.
Hope this helps.

Crystal Reports: Display a group section always on 2 pages

I have a Crystal Report with only one group section on it. After the last group footer I use “New Page After” in order to start each group on a new Page. The Details section in my group depends on the data that comes from the database, so the whole group can sometime take 1 or 2 pages. Theoretically it can take more than 2 pages too. But with the current data the maximum of pages are 2. The new requirement is now to always use 2 pages for each group even if the data in the group does not require a second page. If this is the case, then the second page should be empty (at least the group part of the page).
How can I achieve this with Crystal Reports?
You can achieve it as:
Split your Group Footer, after which you want a blank page, into two sub-sections e.g. Group Footer a, Group Footer b.
To insert a sub-section: open Section Expert, select Group Footer and then click on Insert button.
Create three Formula Fields named as ffReset, ffIncrement and ffCurrent and set their values as:
ffReset:
WhilePrintingRecords;
numberVar counter:=0;
ffIncrement:
WhilePrintingRecords;
numberVar counter:=counter+1;
ffCurrent:
WhilePrintingRecords;
numbervar counter;
Place ffReset in Group Footer b sub-section and ffIncrement in top level Group Header section
Enable / check New Page After option of both of theses sub-sections (i.e. Group Footer a and b) in Section Expert
Set suppression formula of New Page After for Group Footer b sub-section as:
if {#ffCurrent} < 2 then true
Ensure that Suppress Blank Section is unchecked for Group Footer a and b
If required, to disable insert blank page at the end of the report set suppression formula in New Page After as Not OnLastRecord for Group Footer a sub-section only
To repeat Group Headers on every page you may also need to enable / check Repeat Group Header On Each Page option in Group Expert

How to Suprress a Group Header and Display It Upon Group Drilldown?

I'm using Crystal Reports XI to render data from a SQL Stored Procedure. I have created a group in Crystal and have set several summarization metrics for the group. There are half a dozen fields that need to be displayed for each record in a given group. I want to display my summary headers when the group details are hidden and display my detail headers when the user drills down into a group.
I've created two Group Headers. The first contains the headers to display in summary and the second contains headers to display on drilldown. How do I ensure that Group Header B is suppressed until the user drills into the group details?
What I have done in the past is in the section expert or format object, use the X-2 beside the Suppress option. Then enter the formula DrillDownGroupLevel = 0, DrillDownGroupLevel = 1, etc. The number represents how far you are drilling down before it shows up.

Crystal Reports repeats previous groups header together with current header

I have a report made with Crystal Report 10 that is structured like this:
(Note that this example has 1 page with Value A and 2 pages with Value B)
PAGE 1:
Group Header Value A
(Sub)Group Header with some headings for Group Header Value A
Detail section with values for Group Header Value A
PAGE 2:
Group Header Value B
(Sub)Group Header with some headings for Group Header Value B
Detail section with values for Group Header Value B
PAGE 3:
Group Header Value B
(Sub)Group Header with some headings for Group Header Value B
Detail section with values for Group Header Value B
My problem is that when I fill it with data, it displays as follows:
(The Group Header Value A displays also on PAGE 2, together with Group Header Value B)
PAGE 1:
Group Header Value A
(Sub)Group Header with some headings for Group Header Value A
Detail section with values for Group Header Value A
PAGE 2:
Group Header Value A
Group Header Value B
(Sub)Group Header with some headings for Group Header Value B
Detail section with values for Group Header Value B
PAGE 3:
Group Header Value B
(Sub)Group Header with some headings for Group Header Value B
Detail section with values for Group Header Value B
The PAGE 2 should only display Group Header Value B.
How can I stop Group Header Value A from displaying on PAGE 2?
Thanks
POST-EDIT: I actually found a solution to this issue, although since it may not look like a proper solution, I would like to hear of other ways to solve this issue.
My solution is to do as follows:
1. right-click on the Group Header and select "Section Expert".
2. in "Section Expert", tick the checkbox "Underlay Following Sections". This will place any subsequent header on top (on the z-axis) the first groups headers.
3. make sure that the field used for displaying the Group Header data has a black background (and e.g. white text). This way the new subsequent groups names will fully cover the first groups name.
You have to move GroupHeader into the page header section.
but be sure group must be there. only group header moves to the page header section.
then right click on object and edit formula for display string property.
then put this condition on formula editor.
if ({GroupFiledName} = next ({GroupFiledName}))
then
// if you required group header on each page
{GroupFiledName}
// if you not required group header on each page
''
else
next({GroupFiledName})
try it.. it worked for me.
You have to take the GroupHeaderSection for the subHeader. And supress the GroupHeaderSection With formula DRILLDOWNGROUPLEVEL = 0.
In the GroupHeaderSection you can put the Header details for subreports.
Thus you can get the different header