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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to find out how many lines left

Status
Not open for further replies.

ron9999

Programmer
Feb 14, 2003
89
AT
Hi
how can I find out how many lines are left on a page?
if lines left 3< I like to force a newpage
TIA
Ronald
 
Sorry, I hope I'm wrong, but I don't think you can do this.



Reebo
UK
 
Depending upon the complexity of the report, if you knew how many details fit on a report, you could force a new page when a certain number of records were displayed. I have done this with multi-page on demand subreports in order to mimick a page header since subreports don't have page sections.

I only really used it with one group level, and that was a fake group, just so that I could have something to force to repeat on every page. I knew that say 20 detail lines was my optimal page, so I think I created a counter to increment with every detail line and then I checked the state of my counter in the X+2 of the New Page After and the condition would force a new page when the counter reached 21. You would then reset the counter to 0.

~Brian
 
To expand on what Brian said, if you create a counter as in:

whileprintingrecords;
numbervar counter := counter + 1;

...and place it in all relevant sections per page (group headers and footers and details, you will have a pretty good line count, as long as each section is of the same height. Additional inserted sections (like detail_b) would throw this off, since they would have the same count as the parent section.

Then in format->section->new page after->x+2 you would enter:

remainder({@counter},50) = 0 //if you were allowing 50 lines per page

-LB
 
I used to use the approach lbass suggests but it is full of trial and error....the delima comes in when the data is short/group and the group header is a different size compared to the detail line....so it is hard to pinpoint a posiotion on the page this way.

What we should address is why you want this split-to-a-new-page....my guess it is to avoid having orphaned headers.

The best approach to this is to put your First detail record in the Group header itself and suppress the first detail record for that group.

Similarly you can put the Last group record in the Group footer and suppress the last detail record for the group....this avoids having the footer appear with no supporting detail record.

It is easy to do once you understand the concept.

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
thank you all
the report is a offer and I'm not able to track what record is printed.
the details are from
details a
...
...
to
details n
I can not use groups!
one details consist a title it looks like

title
pos item text price
text2 can be 1 to x lines
pos item text price
text2 can be 1 to x lines

if the title is on the last line of the page I want to make a newpage before
Ronald






 
I've had to do similar things that are related to (but not solved by) the normal orphaned header/footer approach Jim mentions. So I used a technique similar to what LB showed, except my counter didn't count lines, it counted inches. So, if the group header was .25 inches high and the detail was only .20 inches high (obviously, &quot;can grow&quot; doesn't work with this approach), I'd get a more accurate calculation of where I am on the page. However, this scenario is very dependent on the printer driver, so it's hard to recommend it for general use. If you know the printer driver will remain the same whenever the report will run, you might consider modifying LB's approach to use inches/millimeters to get a more accurate idea of where you are on the page and if you have room for the following lines/sections on the current page.
 
Just enable a &quot;Keep together&quot; on the detail section ....that should solve this kind of problem

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
thank you,
if I find a solution I'll let you know
Ronald
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top