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

How to maintain vertical size of detail section

Status
Not open for further replies.

mbutch

Programmer
Nov 17, 2000
100
US
I'm creating an invoice report using CR10. I have about 3" of space for the invoice items, which I'm puting into the detail section. I want to start a new page after the order items fill up that 3" of space. How can I do that?
 
I think you need to explain your overall report structure. If you have a group on invoice, then you would probably need to insert a running total (#cntwingrp) that counts the invoice number field (because this will repeat for each record), evaluates for each record, and resets on change of invoice number. Then go to the section expert->details->new page after and enter:

not onlastrecord and
remainder({#cntwingrp}, 18) = 0

...where 18 is the number of lines that fits in the three inch section--adjust as necessary.

-LB
 
That was the approach I was taking, however; there may be more than one line per record and I haven't figured out how to get the running total to work by section. I have 5 detail sections set to supress on blank.

detail1: part number and description
detail2: description2
detail3: special note for drop ship
detail4: special note for back order
detail5: special note for return

Say that I could fit 18 lines in the alloted space, the number of records could vary greatly.

I was hoping there was a way to set the new page break based on physical height.
 
I think you could try a formula like:

//{@linecnt}:
whileprintingrecords;
numbervar linecnt;

if not isnull({table.partnumber}) then
linecnt := linecnt + 1;
if not isnull({table.description2}) then
linecnt := linecnt + 1;
if not isnull({table.specnotedropship}) then
linecnt := linecnt + 1;
if not isnull({table.specnotebackorder}) then
linecnt := linecnt + 1;
if not isnull({table.specialnotereturn}) then
linecnt := linecnt + 1;

Place the formula in one of the detail sections only. Add a reset formula in the invoice number group header:

whileprintingrecords;
numbervar linecnt;
if not inrepeatedgroupheader then
linecnt := 0;

Then use the following formula for your new page after:

not onlastrecord and
remainder({@linecnt}, 18) = 0

-LB
 
Thanks for the reply. With a little manipulation, your formulas worked well except the linecnt variable is still calculated by record. I wasn't able to figure out any way to make it total by section.

So, if I wanted only 7 lines and part A had 2 lines, part B had 3 lines, part C had 3 lines and part D had 3 lines then
remainder({@linecnt}, 7) = 0
would never evaluate to 0 and I'd get all records on one page.

If I do the reset on inrepeatedgroupheader and change the next page after formula to
{@linecnt} >= 7 I get a little better result because the page break will occur when {@linecnt} = 8.

If I could figure out a way to total the number of sections, it would be perfect.

Thanks,

Mike
 
You could adjust the formula if you know the number of characters that will fit in one line. Let's say that the answer is 30. For each formula section, you could rewrite to:

if not isnull({table.description2}) then (
if len({table.description2}) <= 30 then
linecnt := linecnt + 1 else
if len({table.description2}) in 31 to 60 then
linecnt := linecnt + 2 else
if len({table.description2) in 61 to 90 then
linecnt := linecnt + 3); //etc.

For accuracy, you would need to use a nonproportional font like Courier. You would need to have as many clauses as necessary to accommodate the likely maximum length of the field. Then for your new page after, let's assume that a normal page break was at line 50. You would need to determine the largest interval (let's say it's 4 lines )that could result from the formula from one section to the next, and then use that for your page break:

remainder({@linecnt},46) >= 0

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top