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

How to display page number in a cross-tab report

Status
Not open for further replies.

Hm786

Programmer
Apr 5, 2001
88
0
0
US
Hi,

I need help in displaying the page number on the cross tab report on its virtual pages.

Thanks,
Hamida
 
If you have CR XI, go to the field explorer->special fields and drag "Horizontal Page Number" onto the page.

-LB
 
Lbass,

I don't have Crystal reports XI I only have Crystal 9.0.

Thank You,
Hamida
 
Here is a workaround. Insert another report header section RH_a. Insert a crosstab that uses a boolean field for the row, if you have one (so that there aren't a lot of rows), or create a formula that returns true or false and use that as the row. Then for your column field, choose a numberfield that has as many values as the column field in your "real" crosstab. Use any summary you want.

Then create a formula {@pageno}:

whilereadingrecords;
numbervar col;
stringvar x;
numbervar i;
numbervar pageno;

if instr(x,totext({table.number},"000")) = 0 then (
x := x + totext({table.number},"000") + ", ";
col := col + 1
);
for i := 0 to 30 do(
if col in (5*i)+1 to 5*(i+1) then
pageno := i - 1
);
pageno + 2

If you want the page number to lead with "Page:" then change the last line of the formula to:

"Page: "+totext(pageno+2,"00")

Use as many zeros as the maximum number of virtual pages. Otherwise the numbering will not be sequential.

The number of zeros in the formatting of {table.number} should match the length of the longest number in the field. The "30" should be replaced with the number of total columns in your "real" crosstab. Replace the "5"s with the number of columns per page in your real crosstab. Add the above {@pageno} formula as your highest level column in the pagenumbering crosstab, and then resize the columns so that there are the same number of columns (5, in this case) per page. To do this, be sure to format the crosstab to "repeat row labels on each page" on the customize style tab, suppress both row and column totals and also highlight {@pageno} on this same tab and check "suppress subtotals."

Next suppress all fields in the crosstab except the column label which now displays the page number. Then go to the customize style tab->format grid lines->uncheck "show grid". Also uncheck "show cell margins". You can resize the suppressed fields to make them tiny. The crosstab can now be very narrow, and you can minimize the report header section.

When I checked this method against the horizontal pagenumber in XI, it worked accurately.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top