Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line Counting in Crystal Reports 2

Status
Not open for further replies.
May 22, 2006
18
0
0
US
I am using Crystal Reports to create forms. I need to apply a conditional formula that inserts a page break when a page contains a certain number of lines. For instance, if I have two sections that need to be on the same page. I need to know how many lines will fit on one page before going to the next. Is there a function that can, using a counter, keep track of how many lines have printed on a single page, and if this number is reached insert a page break to begin a new page.

Thanks in advance...

Koolbreize
 
If you are only using the detail section, you could just use the special field->recordnumber. I'm guessing you are using group sections as well. There are other ways to force new pages based on sections or to force sections to keep together, so I'd try those first. For help on that, we'd need to know your report structure, group fields, etc.

Otherwise, you can create formulas like this:

//{@reset} to be placed in the page header:
whileprintingrecords;
numbervar linecnt := 0;

//{@linecnt}:
whileprintingrecords;
numbervar linecnt := linecnt + 1;

Place the last formula in all displayed group sections and the detail section. If sections are of different sizes (more than one line), this would have to be adjusted.

-LB
 
Try formulas of:

Details:
whileprintingrecords;
numbervar Cnt:=Cnt+1

Then in the new page after formula use:

whileprintingrecords;
numbervar Cnt;
if Cnt = 40 then //whatever you need here
(
Cnt:=0;
True
)l
else
false

Can't test right now, but the theory is sound.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top