Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Prevent orphaned detail Post Reply Post New Topic
Author Message
ederkley
Newbie
Newbie


Joined: 15 May 2012
Online Status: Offline
Posts: 2
Quote ederkley Replybullet Topic: Prevent orphaned detail
     Posted: 15 May 2012 at 6:12pm
Hi
I've been asked to find out how to avoid the situation where a single detail record from a group will print by itself on a page.
 
I have the report set to start a new page for each group.
Within each group there may be 1 or 100 or 1000 detail records of variable height of 2-6 lines of text.
The datasource includes a field with the total number of detail records for each group to test a running total value against so we know when we're on the last, or second last record.
 
Is there an option to set the minimum number of records per page to 2 so that if the last record ends up on a page by itself then it's previous record joins it?  Obviously it would have to be smart enough to not get into a loop or where there were less than 3 records.
 
One other idea is if I'm on the third last record in a group then unsupress another detail section or field or expand the footer just for that page by enough that to knock the next two detail records together on to the next page.
However, this should only happen if the third last record is 90% of the way down the page and that's where I've hit a wall.
 
Is there any way to access the Y position for the current detail while printing?
I can't just count records per page as they are variable number of lines.
 
Ideally the supress formula would be something like:
(@Group_Count <> {rptSource.Group_Total} - 2) or (currentdetail.top < page.height-4 cms)
 
Cheers
Evahn
 


Edited by ederkley - 15 May 2012 at 6:17pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 16 May 2012 at 3:11am
given your scenario, the best you can hope for is 'keep group together' from the grouping options.
 
CR doesn't tell you where it is on the page. If a row is 6 lines long...just because of it's length, CR won't tell you. If on the other hand it is 6 lines long because it has 5 carriage returns, you can count the lines.
 
Unfortunately, the best that I have found is to count lines, but if rows are growing because of data, the best that you can do is approximate the number of rows based on the length of the data...and with proportional fonts that's a crap shoot.
IP IP Logged
ederkley
Newbie
Newbie


Joined: 15 May 2012
Online Status: Offline
Posts: 2
Quote ederkley Replybullet Posted: 16 May 2012 at 1:10pm
ouch - thanks for the confirmation.
 
Might have to try to recreate the report programatically in MS Word and hope noone ever asks for the same requirement again ;)
IP IP Logged
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