cancel
Showing results for 
Search instead for 
Did you mean: 

Suppress Orphaned Group Headers

Former Member
0 Kudos

I need a way to make sure a group header is not the last thing on the page without keeping the entire group together. The group is too large to keep together. All I want is to make sure the group header is not the last thing printed on a page. Any ideas?

Fuskie

Who gets large areas of white space when he tries to keep the group together due to the amount of splittable detail within the group...

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member292966
Active Contributor
0 Kudos

Hi Fuskie,

In the GroupHeader Suppress formula say:

OnLastRecord;

This will suppress the header if it's forced onto the last page.

If you have NewPageAfter selected then ignore above and int he NewPageAfter formula use:

Not(OnLastRecord);

This will not force a page break if the last record is too close to the bottom of the page.

Good luck,

Brian

Former Member
0 Kudos

Thanks, Brian, but that wasn't really my problem. Look at it this way. Here is the data I have in a report:

Group Header A
Data 1
Data 2
Data 3
Data 4
Group Header B
Data 5
Data 6
Data 7
Data 8

Now the data sections are kind of long so the report formats like this:

Group Header A
Data 1
Data 2
Data 3
Data 4
Group Header B
<PAGE BREAK>
Data 5
Data 6
Data 7
Data 8

What I want is for it to format like this:

Group Header A
Data 1
Data 2
Data 3
Data 4
<PAGE BREAK>
Group Header B
Data 5
Data 6
Data 7
Data 8

I wish there was a section property such as Do Not Orphan Section and Do Not Widow Section.

Fuskie

Who foolishly keeps hoping Business Objects would address this long time issue in an update...

former_member292966
Active Contributor
0 Kudos

Hi Fuskie,

Can you turn on NewPageAfter in the Group Footer? This will force the next group to start on the next page regardless.

A more complicated method is to create a counter and after 20 lines or so force a page break. I've tried this and can get complicated depending on the design of your report.

Good luck,

Brian

Former Member
0 Kudos

Theoretically, I could put in an inch counter, adding to it with each iteration of each section the amoun of vertical space of that section. Then I can add to each group header section a conditional expression for a new page before if the current vertical position plus the height of the current section exceeds my page length.

Fuskie

Who is not looking forward to trying this out...

Former Member
0 Kudos

I hope this article may help you.

KBase Article ID:c2000972

Article refers to:Crystal Reports 9

Symptom

In Crystal Reports (CR), when printing or

previewing a report, the Group Header displays at

the bottom of the page and the group's records are

displayed on the following page instead of on the

same page as the Group Header. This is also known

as an orphaned group header.

How do you prevent an orphaned group header?

Resolution

There are two ways to prevent an orphaned group

header.

Method One:

You can select the 'Keep Group Together' option

available in the 'Group Expert', similar to the

option found in the 'Section Expert'. You can access

the Group Expert through 'Report' on the menu

('Change Group Expert' in CR 8.5 and earlier).

- OR -

Method Two:

1. Insert a section below the Group Header to

create Group Header 1a and Group Header 1b.

2. Copy all the fields from the Details section

into Group Header 1b. Group Header 1b and the

Details section must appear in the same

format.

3. Copy the original Group Header into Group

Header 1a.

4. From the 'Report' menu, click 'Section Expert'.

(In CR 8.5 and earlier, from the 'Format' menu,

click 'Section'.)

5. From the 'Section Expert' dialog box, select

'Group Header' from the list of sections and select

the 'Keep Together' check box.

6. Select 'Details' from the list of sections and

click the 'X + 2' button beside the 'Suppress'

check box. Keep this check box unselected.

7. In the 'Format Formula Editor' dialog box, type

the following conditional suppression formula:

//This formula conditionally suppresses

//the first record of the Details section.

//Replace {database.field} with the field

//by which you are grouping.

WhilePrintingRecords;

Onfirstrecord or {database.field} <>

Previous({database.field})

Upon completing these steps, the Details section

will display all the group's records except for the

first record. Group Header 1b will always display the

first record. If the group's records display on the

following page, Group Header 1a and Group

Header 1b will always print together.

Therefore, this solution will prevent the

appearance of an orphaned group header.

Regards,

Raghavendra

Former Member
0 Kudos

That is an interesting approach. What happens if I have nested group headers:

Group Header A
Group Header B
Data 1
Data 2
Data 3
Data 4
GroupHeader A
<PAGE BREAK>
GroupHeader B
Data 5
Data 6
Data 7
Data 8

Or another scenario I find is:

Group Header A
Group Header B
Data 1
Data 2
Data 3
Data 4
GroupHeader A
GroupHeader B
<PAGE BREAK>
Data 5
Data 6
Data 7
Data 8

Fuskie

Who fears he will have to build in so many exceptions as to make the report unusable (not to mention having many reports with this problem)...

Former Member
0 Kudos

having more groups makes complicate to solve. I think still you can place the two group headers with the first record and supress it conditionally.

Regards,

Raghavendra