Print Page | Close Window

group on new page

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=13378
Printed Date: 20 Apr 2025 at 3:05pm


Topic: group on new page
Posted By: passaia
Subject: group on new page
Date Posted: 01 Jun 2011 at 8:18am

Hello, I'm trying to create a report where the group changes the page only if there is no space on the same page for details.

with keeptogheter I saw that page change only if the group does not fit completely on the same page, while without keeptogether it could happen that the last line written on your page is the header of the group.. I would like to avoid this case, the group must be written on the same page only if there is at least one line of detail on the same page, otherwise he must go to the new page..


is it possible?
where am I wrong?

Thank you and sorry for the banality of the question, it's driving me crazy!




Replies:
Posted By: lockwelle
Date Posted: 02 Jun 2011 at 4:18am

the only other option is line counting, but this can be hit or miss if you have can grow on for a field.  with line counting, you could put a formula in the new page before in the section expert that will force the new page if there isn't enough room as determined by you.

 
HTH


Posted By: passaia
Date Posted: 02 Jun 2011 at 4:27am

thanks for the answer!

do you have any idea of the formula you suggest??
i don't see anything about the free available space of the page!
thanke you very much!


Posted By: lockwelle
Date Posted: 02 Jun 2011 at 6:56am
this is where it gets difficult...
print the report, count the lines in the area to be displayed
are group headers/footers larger/smaller than the details
take a best guess and everytime a header/footer/detail is displayed increment a counter (i like shared variables, but global would work)
 
then in the section expert, compare the value of the counter against the 'max' (the number that you counted) and if needed force a new page.
 
the section expert formula would look something like:
shared numbervar counted;
(25 - counted) < 2
 
25 is made up, 25 lines to the page. 
counted, how many lines have already been displayed.
2  1 line for the header + 1 line of detail
 
HTH


Posted By: passaia
Date Posted: 02 Jun 2011 at 7:58am
excuse me..
I don't know where I could declare and increment a variable.. could you explain me better.. as a child please??



Print Page | Close Window