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

Limiting the amount of data returned per page 1

Status
Not open for further replies.

iwm

Programmer
Feb 7, 2001
55
US
I am trying to limit the amount of data returned per page.
I am working with 4.5W inches x 9H inches section which I have placed in the Page Header of my report.

I am using THE SELECTION EXPERT - NEW PAGE BEFORE in order to accomplish my task.

This is the formula I am using THE SELECTION EXPERT - NEW PAGE BEFORE:

Whileprintingrecords;
(RecordNumber mod 15) = 0

This formula allows the user 15-detail lines before going to a second page.
EXAMPLE:
# item QTY amount Ttl
1 desks 2 10.00 20.00
2 chairs 4 25.00 100.00
3 lamps 3 15.00 45.00

However, the formula doesn't take into account the possibility of the user has having 15 or fewer detail lines
which wrap around in excess of the 4.5 inches allotted for width of the section.
EXAMPLE:
item QTY AMT TTL
1 blue 10 30.00 300.00
leather
chair w/
vinyl
head
wrest
2 wooden 2 100.00 200.00
desk
If I have 15 lengthy detail lines as illustrated in example # 2 they will exceed my aloted space but doesn't exceed the number of detail lines I am allowing to appear per page. As a consequence the detail lines overflow the aloted 4.5 x 9 rectangle section.
Do you have any suggestion on limiting the details lines based on something besides the record Number?
Your assistance in this matter is greatly appreciated.

Ingrid
 
Instead of using record number, create a formula like the following for the detail section:

whileprintingrecords;
numbervar cnt;
cnt := cnt + ubound(split({table.item}," "));

Place a reset formula in the page header:

whileprintingrecords;
numbervar cnt := 0;

Then in the section expert use a formula in the detail->new page BEFORE->x+2 section:

whileprintingrecords;
numbervar cnt;
cnt >= 15

This will not be exact, but might suit your purposes. If you want to get close to 15 lines but definitely not go over, you could add a constant value like 2 or 3 to the first formula. You'll have to play with it. It looks like the item is breaking mostly on words, which is why I used the split function to estimate the number of lines.

You could also use len() to determine the length of the field and then divide it by the number of characters per line--you would have to use a nonproportional font like Courier, but this doesn't take into account the wrapping based on word breaks.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top