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

Limiting the number of detail lines returns 1

Status
Not open for further replies.

iwm

Programmer
Feb 7, 2001
55
US
Is there any way to limit the details returned based on the dimensions of the detail area.

Here is my dilemma:


This form has room for a maximum of 7 detail lines per page. So, I entered (RecordNumber mod 8) = 0 in New Page Before from the Section Expert. However, the first detail record utilizes three lines causing the 7th detail line to overextend the details area.

The dimensions of the details area are of 3.95W x 1.98H. Is it possible to limit the space populated by detail lines based on the dimensions? If not, do you have any suggestions on fixing this problem?

Your assistance in this matter is greatly appreciated.

Ingrid

 
You need to count the lines, and assume a maximum number of characters per line, which may be problematic...

page header formula to reset:
whileprintingrecords;
numbervar linecount:=0

New Page Before formula in the details section:
whileprintingrecords;
numbervar linecount;
numbervar linecount:=linecount+int(round((len({table.field})/30)+.5));
Linecount > 7

Adjust the 30 accordingly and this should get you very close.

-k
 
If you are able to use a non-proportional font like Courier, you could then determine the number of characters before the field would wrap. For this example, let's say it is 20. Then you could create a formula like the following:

whileprintingrecords;
numbervar lenx := -int(-len({table.field})/20);
numbervar cnt := cnt + lenx;

Place this in the detail section. Then create a reset formula to place in the page header:

whileprintingrecords;
numbervar cnt := 0;

Then you could use a conditional formula in the new page before formula area:
whileprintingrecords;
numbervar cnt;

cnt >= 8

This would cause a return if the next record resulted in a line count >= 8. If you have multiple fields, and you are not sure which fields might wrap, then you could adapt the formula as follows:

whileprintingrecords;
numbervar lenx := -int(-len({table.field1})/20); //wraps at 20
numbervar leny := -int(-len({table.field2})/14); //wraps at 14
numbervar cnt := cnt + maximum([lenx, leny]);

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top