Technical Questions
 Crystal Reports Forum : Crystal Reports 9, X, XI, 2008, 2011 : Technical Questions
Message Icon Topic: Orphaned Group Headers Post Reply Post New Topic
Author Message
christoph
Newbie
Newbie


Joined: 07 Jul 2009
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote christoph Replybullet Topic: Orphaned Group Headers
    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 
IP IP Logged
lockwelle
Senior Member
Senior Member


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4168
Quote lockwelle Replybullet 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
IP IP Logged
christoph
Newbie
Newbie


Joined: 07 Jul 2009
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote christoph Replybullet 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
IP IP Logged
lockwelle
Senior Member
Senior Member


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4168
Quote lockwelle Replybullet 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.
IP IP Logged
christoph
Newbie
Newbie


Joined: 07 Jul 2009
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote christoph Replybullet 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

 

 

 

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.094 seconds.

FREE ADVANCED
Crystal Reports Training!

Plus, free bonus PDF cheat sheet! Advanced Crystal Reports Training Give Me Advanced Training!