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 create multiple page report ??

Status
Not open for further replies.

nirajj

Programmer
Mar 12, 2003
103
US
I need to create a report that will print in 6 pages (always). The data for all the pages will be from different cursors (created by sqlpassthru). I want to know what will be the best way to design this report ?

One option I was thinking is to create six different groups and make the group header act as detail band.

Can somebody tell me what is the best way to do it ?

Thanks!
 
nirajjobanputra

How about creating six diffent cursors, adding an extra field in each resulting cursors and inserting a different "group" value for each cursors and using your idea and creating a group in your report and setting the "Start each group on a new page". Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Okay, Here is something that seems to be working for me.

Instead of 6 different cursors I create single cursor. Something like : (For now lets assume 2 cursors)

Select "a" as fld1, "b" as fld2, " " as fld3 from cursor1 ;
union all ;
select "1" as fld1, "2" as fld2, "3" as fld3 from cursor2 ;
into cursor ReportCursor

Ofcourse all the columns will have to be in same data type. Which doesnt seem to be big problem.

Now comes the logic-
Prior to report execution, I must know the count(*) from cursor1 and cursor2(gnCntCur1 & gnCntCur2)

In the report create Data Group on some variable (gnPageBreak). Set Initial value to 0 and Value to store to itself. Start each group on new page.

On exit of detail band, CheckForPageBreak()
PROCEDURE CheckForPageBreak
IF RECNO() = gnCntCur1
gnPageBreak = gnPageBreak +1 && This will create
another group on the report
ENDIF
ENDPROC

Ofcourse for different groups I need different labels. For that Set Print When to RECNO() > gnCntCur1. Proper check can be made for each labels.

And for that extra column from cursor1 (i.e. fld3) It is just to ensure both queries have equal number of columns.

Report formatting can become time consuming but isnt that very difficult.

I tried to explain what I am doing as much clear as I could.

Thanks Mike for the solution you provided. I am going to try that as well. Do let me know if you see any problems/bugs with what I am trying to implement.

 
Seems like having 6 different reports (one for each page) might have been easier.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top