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!

Build Index Page in Report Footer 1

Status
Not open for further replies.

TimothyP

Programmer
Aug 6, 2002
135
US
Hello,

I am using Crystal Reports 2013.

I have a SQL table that looks like this with thousands of records.
2019-01-04_9-16-53_r2bigk.png


My report groups by and does a page break on Dept. There are many pages per Dept. The current report (mainframe COBOL) I am converting, has an index page at the end that shows each Dept analyst the page number where their fuel charges begin and end.

Is there a way to do this in Crystal Reports?

Thanks in advance for any assistance you can provide.
TimothyP
 
How many departments are there? Does the report always contain the same departments?

-LB
 
There are 30 departments. The report always contains the same departments.

TimothyP
 
Create three formulas:

//{@start} to be placed in the department group header:
whileprintingrecords;
stringvar array dept;
numbervar array spg;
numbervar i := i + 1;
if i <= 30 then (
redim preserve dept;
redim preserve spg;
if onfirstrecord or
{table.dept}<>previous({table.dept}) then
(
dept := {table.dept};
spg := pagenumber
));

//{@end} to be placed in the department group footer:
whileprintingrecords;
stringvar array dept;
numbervar array spg;
numbervar array endpg;
numbervar j := j + 1;
stringvar z;
if j <= 30 then (
redim preserve endpg[j];
if onlastrecord or
{table.dept}<>next({table.dept}) then
endpg[j] := pagenumber
);
z := z + dept[j]+": "+totext(spg[j],0,"")+" - "+totext(endpg[j],0,"")+chr(13)

//{@display index} to be placed in the report footer and formatted to "can grow":
whileprintingrecords;
stringvar z;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top