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

New page based on record count of multiple details sections

Status
Not open for further replies.

Llazwas

IS-IT--Management
Feb 16, 2007
58
US
Using Crystal XI with a ProvideX database.
I'm writing an invoice form grouped by invoice number with 5 details sections and need Crystal to create a second page after 20 detail records. Some of the detail sections may be blank while other populated, which is where I think I'm having the trouble.

This is what I have so far and it doesn't seem to be working depending on which details sections are blank.

I placed a counter @counter in the last detail section:
whileprintingrecords;
NumberVar Counter;
Counter:=Counter + 1

A reset in @reset in the page header:
whileprintingrecords;
NumberVar Counter;
Counter:=0

Any help is greatly appreciated!
 
Hi Llazwas

You are very nearly there. Final step is to make it create the new page after 20 detail lines. For CR XI, go into the Section Expert. select Detail, click on the x2 button to the right of New Page After (but do not put a tick in the box) and in the formula editor box type:

Code:
{@Counter} = 20

Hope this helps

Cheers
Pete
 
Hey Pete, thanks for the info. I had tried this before without success but tried it again to see if I overlooked something. I found that it's not really counting each detail section because my database detail records are split in to different detail sections.

Database detail record example:

Item Number, quantity, price, extended amount, comment

My report:

Details a: item number, quantity, price, extended amount
Details b: comment

It looks like it's counting the above as one detail record but I need it to count it as two. I hope that makes sense.
 
Thanks Ian. I placed a counter in both sections but had to do a few more things to get it to generate a new page after 20 detail lines. Here are the details

I placed these in the page header to reset the counts to zero on each page.
@Detail1CounterReset
whileprintingrecords;
NumberVar Counter;
Counter:=0

@Detail2CounterReset
whileprintingrecords;
NumberVar Counter2;
Counter2:=0


I placed this in the first detail section
@Detail1Counter
whileprintingrecords;
NumberVar Counter;
Counter:=Counter + 1

I placed this in the second detail section. My second section contained this field:{SO_InvoiceWrk.CommentText} so I had to make sure it wasn't empty.
@Detail2Counter
whileprintingrecords;
NumberVar Counter2;
NumberVar Counter;
if {SO_InvoiceWrk.CommentText}<>"" then Counter2:=Counter2 + 1 else counter2:=Counter2;
Counter + Counter2

I entered this in the New Page After formula section of details section 2. I had to add " NEXT({SO_InvoiceWrk.LineSeqNo}) <> "" " to prevent generation of a blank page if the line count equaled exactly 20.
{@CommentCounter} > 20 and NEXT({SO_InvoiceWrk.LineSeqNo}) <>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top