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

Minimum # of lines on Page

Status
Not open for further replies.

peterp2

Programmer
May 4, 2004
3
US
We are evaluating Crystal Reports 10 - and trying to figure out if it will suit our needs.
We have a very demanding client that needs a report to go out to his clients in a particular way.

The report has a header/footer and then group headers and footers and then finally several detail records.

The detail records can span anything from 1 to 40 lines.

Is there a way to print a minimum # of lines on a page (before inserting a page break), and a minimum # of lines after a page break.

My client wants a minimum of 2 detail lines to appear on a page.
i.e. if the bottom of page 1 allows for 2 lines, and there are a total of 3 lines in the detail then all 3 lines must be printed on the 2nd page (as the 2nd page cannot have 1 detail line only).
If the bottom of page 1 allows for 2 detail lines and the # of lines in the detail is 4 then he wants 2 lines on bottom of page 1, and 2 lines on top of page 2.

To complicate things further, if the group changes, he does not want group headers orphaned on their own (I have seen documentation on this, but it only pertains to grouping a detail line - as opposed to lines within a detail).
Thanks for any help or pointers in advance.



 
I'm a bit confused, as it appears others are by your explanation. Rather than using text to attempt to describe data, try posting example data and expected output.

You can certainly use a counter variable to keep track of the number of lines per page, detail or otherwise, and you can insert a page break conditionally based on this, but I would suggest posting something meaningful about the data and requirements as there's too much left to the imagination here.

-k
 
I think you could handle this by doing the following:

Insert a second group header section and a second group footer section. In GH#1a, place the group fields and also copy the detail fields into an area below the other group fields. In GH#1b, insert formulas for each detail field using the next() function, as in:

next({table.amt})

In the GF#1a section, insert formulas for each detail field using the previous function as in:

previous({table.amt})

Copy the detail fields into GF#1b. Then using the running total expert, create a running total {#cntwingrp}:

select your group field {table.group}, count, evaluate for each record, reset on change of group.

Then go to the section expert and format as follows:

Check "Keep Together" for GH#1 (the higher order group section), GH#1a, GH#1b, GF#1 (higher order), GF#1a, and GF#1b. For the detail section, enter the following into the x+2 box next to "Keep together":

count({table.group},{table.group}) <= 3

For the detail section also go to suppress->x+2 and enter:
{#cntwingrp} in 1 to 2 or
{#cntwingrp} in count({table.group}, {table.group}) - 1 to
count({table.group}, {table.group})

Then for GH#1b go to suppress->x+2 and enter:

count({table.group}, {table.group}) = 1

For GF#1a, go to suppress->x+2 and enter:

count({table.group}, {table.group}) <= 3

For GF#1b, go to suppress->x+2 and enter:

count({table.group}, {table.group}) <= 2

This seemed to work when I tested with a small sample.

-LB
 
Thank you for your replies, and I'll certainly try what has been suggested - below is an example of the sort of data we require to appear in reports.

Bottom of page 1...

Group Header 1
Group Header 2
Group Header 3

Record 1 Detail line 1
Record 1 Detail line 2

<Page Break>

Record 1 Detail line 3
Record 1 Detail line 4

Record 2 Detail line 1
Record 2 Detail line 2
Record 2 Detail line 3

Record 3 Detail line 1

All of the detail lines come from a single text field, they may be wrapped, or they may have carraige returns. The number of detail lines can vary from record to record. There are a couple of scenarios that our client wants to avoid.
1 - Any of the Group Headers appearing on their own at the bottom of a page (all Group Headers should appear together).
2. There must be a minimum of 2 detail lines at the bottom of the page (provided there are 2 detail lines in the field).
3. There must be a minimum of 2 detail lines at the top of a page.

i.e. the below is unacceptable to the client

Bottom of page 1...

Group Header 1
Group Header 2
Group Header 3

<Page Break>

Record 1 Detail line 1
Record 1 Detail line 2
Record 1 Detail line 3
Record 1 Detail line 4

Record 2 Detail line 1
Record 2 Detail line 2
Record 2 Detail line 3

Record 3 Detail line 1

The below is unacceptable to the client

Bottom of page 1...

Group Header 1
Group Header 2
Group Header 3

Record 1 Detail line 1

<Page Break>

Record 1 Detail line 2
Record 1 Detail line 3
Record 1 Detail line 4

Record 2 Detail line 1
Record 2 Detail line 2
Record 2 Detail line 3

Record 3 Detail line 1

The below is unacceptable to the client

Bottom of page 1...

Group Header 1
Group Header 2
Group Header 3

Record 1 Detail line 1
Record 1 Detail line 2
Record 1 Detail line 3

<Page Break>

Record 1 Detail line 4

Record 2 Detail line 1
Record 2 Detail line 2
Record 2 Detail line 3

Record 3 Detail line 1

Thanks in advance....
 
Can anyone help with this?? lbass reply is great if you have 1 line per detail - unfortunately we van have anything from 1 to 50 lines per detail.

How do we make the details split when we want to, and print after a page when we want to - depending on the # of lines in the details?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top