Print Page | Close Window

Orphaned Group Headers

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=6979
Printed Date: 26 Apr 2024 at 12:46pm


Topic: Orphaned Group Headers
Posted By: christoph
Subject: Orphaned Group Headers
Date Posted: 07 Jul 2009 at 4:56am
I am trying to solve a problem with orphaned group headers. The report comprise a group heading and 3 details sections. The problem I have is that I am trying to prevent header appearing at the end of pages without at least the first details record or if there is insufficient space the report throw a page break before the header. 
 
I am unable to use the keep together option on the group and this would generate too many page breaks. I have trawlled lots of website and tried a number of approaches but none seem to work consistently, especially as the number of records per section varies from week to week. What I would like to be able to do is ensure that the header and first record in a group are kept together.
 
Thanks 



Replies:
Posted By: lockwelle
Date Posted: 07 Jul 2009 at 6:35am
Unfortunately, there isn't a sure fire way.  The best that i can suggest is counting / measuring where you are on the page and then forcing a 'New Page Before' if the measure is over a certain amount.
 
Create a formula for each section of the report.  All that this formula does is increment a shared variable by the height of the section.  In Section Expert, for the group header in question, in the New Page Before section add a formula that references the shared variable and returns true if the height is over a certain amount.  In the page header section, reset the variable to the height of the section.
 
It will get you in the ball park, can't guarantee anything, Crystal can be persnickedy at times.  Sections with a field that Can Grow will also mess with this calculation as you may not 'know' the height of a section.
 
Good Luck.
HTH


Posted By: christoph
Date Posted: 07 Jul 2009 at 8:25am
Thanks for the response I will have another go at the measuring. What I came up with before was to identify the fix size fields and with the variable field I took the field length divided by a number of characters and rounded put. I then added the length to a shared variable and then tied a calculation. Unfortunately I didn't seem to get it right. The difficultly was that the header used a different size font so it was difficult to estimate the number of lines. More experimentation required!
 
Thanks again.
 
Chris


Posted By: lockwelle
Date Posted: 07 Jul 2009 at 3:08pm
Yeah, Crystal is pretty hard to work with that way since the length can vary with the font.  CR XI has the size and position, and I figure that should give a good estimate of height...it is the can grows that bother me, since you don't know how long they might be... more math can figure that out if needed.


Posted By: christoph
Date Posted: 08 Jul 2009 at 6:06am

I think I have fixed it! Thanks to the suggestion I looked up the field sizes for the fixed data and used a formula to estimate the number of lines in the variable fields then multipled by an average line height. Once I had the sizes it was quite easy to create a New Page before formula, although only time will tell!!

Thanks for the assistance Smile

Chris

 

 

 




Print Page | Close Window