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

Limit No. Detail Lines on preprinted form

Status
Not open for further replies.

knitwit

Technical User
Apr 14, 2003
55
US
I have a preprinted form that my crystal report will print on. It is a simple report with one grouping.
If the detail section has too many rows, it will overwrite the preprinted footer section on the form.
Can I count the no. of detail rows and pagebreak after the count = a certain no.?
 
Why not just increase the height of the page footer? That would force the Details to accomodate the whole footer.

-dave
 
I tried that. But then when the group footer prints, it doesn't hit at the bottom of the page to fit the preprinted form. The footer would then print above the area on the page where it belongs.
 
You can try using the special field RecordNumber to determine the current line number. That should work as long as you aren't conditionally suppressing any detail sections.

If you need to know the # of detail lines per group, you can do it with 2 formulas:
[tt]
//@Init
//Put this in your Group Header
//(If you want to get the # of lines per page,
// then you can put this in the Page Header instead)
WhilePrintingRecords;
NumberVar lineNum := 0;

//@Increment
//Put this in your Details section
WhilePrintingRecords;
NumberVar lineNum := lineNum + 1;
[/tt]
To force a page break after a certain line number, use a formula for 'New Page After':
[tt]
WhilePrintingRecords;
NumberVar lineNum;
If lineNum = [whatever your Max is] Then
True
Else
False
[/tt]
-dave
 
It is a lot easier than Vidru's solution.

Right click the detail section and select format section. Click the X-2 button to the right of "New Page After" and enter a formula:

Remainder(Recordnumber,N)=0

Replace N with the total number of detail lines you want on a page.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Is it the page footer or the group footer that is populating the preprinted form? If the details run onto the second page, but you want the group footer to print at the bottom of the page, not where the details end, you can use the section expert to format the group footer with "Print at Bottom of Page."

-LB
 
If you are only concerned with too many detail records for your formatted page, you should count the detail records and skip to a new page when the count reached the maximum amount that will properly print on the page. To do this create a variable counter:

WhilePrintingRecords:
NumberVar MyCounter:= MyCounter + 1

Create a section 'b' in your detail section and place your couner formula field in detail section b.

Reverse detail sections a and b so that the counter is in detail section a.

Format the detail section by unchecking "Keep Group Together".
Format detail section b by conditionally forcing a new page before if:
Remainder(MyCounter,N)=1 //counter was incremented in detail section 'a'.

Create formula to reset Mycounter to 1 (remember it was already incremented for the next record) and place in page header.

Hope this works for you.

MrBill
 
Thanks. I tried the recordNumber count and it worked for the first group. But....I need the count to reset to 0 when a new group is started.

Each group is a different customer, when the form breaks on the group for the customer - the record count continues from the previous customer. So that the page may break only after 2 records instead of 30 records.

Any suggestions?
 
Try this solution :
Keep the height of the page footer you had before
Then create a new section in the page footer, the same height than the group footer. Put this section above your first page footer section.
In the suppress formula in section expert for this new section put the formula :

if onlastrecord then true else
if next({groupField})= ({groupField}) then true

--------------------------------------------------
[highlight]Django[/highlight] [thumbsup]
bug exterminator
tips'n tricks addict
 
oops I forgot to tell that groupField means the field the grouping is on (customerId?)

Another possible trick is to put in this section a text like :

customer {custumerId} continues on following page ...



--------------------------------------------------
[highlight]Django[/highlight] [thumbsup]
bug exterminator
tips'n tricks addict
 
oops once more,this time the formula is wrong :

if onlastrecord then true else
if not(next({groupField})=({groupField})) then true

--------------------------------------------------
[highlight]Django[/highlight] [thumbsup]
bug exterminator
tips'n tricks addict
 
knitwit,

Vidru already gave you a solution that will work for groups. Please see his second post and use the line number formulas there.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top