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

page numbers for subreport in report footer section

Status
Not open for further replies.

koolskins

IS-IT--Management
Nov 22, 2003
79
US
Running CR10 against an Informix db. I have a report designed to print vendor specific information (group header level) and requisition information (report footer level) for one or more vendors with one or more requisitions included. The report is a REQUEST FOR QUOTES document and is printed once and then faxed to the vendors so the request is to only print the actual requisition data one time instead of once per vendor. To do this, I have placed the requisition in the report footer section which serves the purpose well. How do I take the page number from the group header and continue it to the report footer so that each vendor will see their cover page (page 1) and then all requisition pages that follow (page 2 to ~)? Thanks. rw
 
Use a couple of formulae; one to set a variable to zero in the group header and another to increment the variable in each page footer and then display it. The variable will have to be declared so that it is shared between the multiple formulae.

However, this will not work properly if you are using sub-reports that have multiple pages since the formula will only be visible at the main report level.

I hate sub-reports and it is often possible to avoid them by designing the report differently, so go down that route if you can.

 
Create three formulas:

//{@page1} to be placed in the group header:
whileprintingrecords;
numbervar pageno := 1;

//{@flag} to be placed in a report header_a section, with the section suppressed:

whileprintingrecords;
booleanvar flag := true;

//{@pageno} to be placed in the page footer:
whileprintingrecords;
numbervar pageno;
booleanvar flag;

if flag = true then
pageno := pageno + 1;

Then right click on {@pageno}->format field->number->customize->check "suppress if zero".

-LB
 
siggy19: unfortunately the requisition data being printed can span many pages.

lbass: sorry, after reading your proposed solution, I realized that I misrepresented the layout by not specifying that the requisition data is being generated in a subreport that is being printed from the main report's report footer. If I print a final report being submitted to three vendors where the requisition data itself is taking 3 pages what I need to see is:

VENDOR A cover sheet page 1 of 4
VENDOR B cover sheet page 1 of 4
VENDOR C cover sheet page 1 of 4

REQUISITION DATA (subreport) page 2 of 4
REQUISITION DATA (subreport) page 3 of 4
REQUISITION DATA (subreport) page 4 of 4
 
The only thing I can suggest is to hard code the page number on the main report as "Page 1" and then start the page numbering on the subreport at page 2. You will not be able to do the Page x of y thing since you do not know how many pages are being generated by each subreport.

Like I say, I hate subreports... if you can redesign the report so that you can eliminate the subreports, it will probably run faster, more reliably and needing much less maintenance as well as allowing you to make it look good !
 
I understood that. I didn't account for the page N of M though. Change the formulas as follows:

//{@page1} to be placed in the group header:
whileprintingrecords;
numbervar pageno := 1;

"Page "+totext(pageno,0,"") + " of "+ totext(totalpagecount-distinctcount({table.vendorID})+1,0,"")

//{@pageno}:
whileprintingrecords;
numbervar pageno;
booleanvar flag;

if flag = true then
pageno := pageno + 1;

"Page "+totext(pageno,0,"") + " of "+ totext(totalpagecount - distinctount({table.vendorID})+1,0,"")

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top