| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > ReportManager Class >====== ReportManager Concepts {{c6h0009.jpg|C6H0009.jpg}} ====== | [[reportmanager overview.htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[reportmanager properties.htm|{{btn_next_n.gif|Next page}}]] | | || The ReportManager supports a batch report procedure, complete with progress window, print preview, DETAIL specific record filtering, and optimized sharing of machine resources. **ReportManager Relationship to Other Application Builder Classes** The ReportManager is derived from the WindowManager because it supports a progress window to provide appropriate visual feedback to the end user (see //[[windowmanager.htm|WindowManager]] //for more information). The ReportManager uses the ProcessClass to manage the batch processing of the REPORT's underlying VIEW. The ReportManager optionally uses the PrintPreviewClass to provide a full-featured print preview for the report. If your program instantiates the ReportManager, it should also instantiate the ProcessClass and may need the PrintPreviewClass as well. Much of this is automatic when you INCLUDE the ReportManager header (ABREPORT.INC) in your program's data section. See the [[reportmanager concepts.htm#a2fsho0|Conceptual Example]]. **ReportManager ABC Template Implementation** The Report Procedure template and the Report Wizard Utility template automatically generate all the code and include all the classes necessary to support your application's template generated reports. These Report templates generate code to instantiate a ReportManager object called ThisWindow for each report procedure. The Report templates also instantiate a ProcessClass object and optionally a PrintPreviewClass object for the ThisWindow object to use. The ThisWindow object supports all the functionality specified in the Report template's **Report Properties** dialog. See //Procedure Templates--Report //for more information. **ReportManager Source Files** The ReportManager source code is installed by default to the Clarion \LIBSRC folder. The ReportManager source code and their respective components are contained in: | | ABREPORT.INC | ReportManager declarations | | | ABREPORT.CLW | ReportManager method definitions | **ReportManager Conceptual Example** The following example shows a typical sequence of statements to declare, instantiate, initialize, use and terminate a ReportManager and related objects. This example uses the ReportManager object to preview a very simple report before printing it. The program specifies a maximized print preview window. **   PROGRAM** **   INCLUDE('ABREPORT.INC')  !declare ReportManager &** **                            !and PrintPreviewClass** **  MAP** **  END** **GlobalErrors ErrorClass** **VCRRequest  LONG(0),THREAD** **Customer   FILE,DRIVER('TOPSPEED'),PRE(CUS),THREAD** **BYNUMBER    KEY(CUS:CUSTNO),NOCASE,OPT,PRIMARY** **Record      RECORD,PRE()** **CUSTNO       LONG** **Name         STRING(30)** **State        STRING(2)** **            END** **           END** **Access:Customer CLASS(FileManager)      !declare Access:Customer object** **Init             PROCEDURE** **                END** **Relate:Customer CLASS(RelationManager)  !declare Relate:Customer object** **Init             PROCEDURE** **                END** **CusView  VIEW(Customer)                 !declare CusView VIEW** **         END** **PctDone     BYTE                        !track progress variable** **report  REPORT,AT(1000,1542,6000,7458),PRE(RPT),FONT('Arial',10,,),THOUS** **      HEADER,AT(1000,1000,6000,542),FONT(,,,FONT:bold)** **       STRING('Customers'),AT(2000,20),FONT(,14,,)** **       STRING('Id'),AT(52,313),TRN** **       STRING('Name'),AT(2052,313),TRN** **       STRING('State'),AT(4052,313),TRN** **      END** **detail   DETAIL,AT(,,6000,281),USE(?detail)** **       STRING(@n-14),AT(52,52),USE(CUS:CUSTNO)** **       STRING(@s30),AT(2052,52),USE(CUS:NAME)** **       STRING(@s2),AT(4052,52),USE(CUS:State)** **      END** **      FOOTER,AT(1000,9000,6000,219)** **       STRING(@pPage <;<;<;#p),AT(5250,31),PAGENO,USE(?PageCount)** **      END** **     END** **ProgressWindow WINDOW('Progress...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE** **         PROGRESS,USE(PctDone),AT(15,15,111,12),RANGE(0,100)** **         STRING(''),AT(0,3,141,10),USE(?UserString),CENTER** **         STRING(''),AT(0,30,141,10),USE(?TxtDone),CENTER** **         BUTTON('Cancel'),AT(45,42),USE(?Cancel)** **        END** **ThisProcedure CLASS(ReportManager)      !declare ThisProcedure object** **Init           PROCEDURE(),BYTE,PROC,VIRTUAL** **Kill           PROCEDURE(),BYTE,PROC,VIRTUAL** **              END** **CusReport   CLASS(ProcessClass)         !declare CusReport object** **TakeRecord   PROCEDURE(),BYTE,PROC,VIRTUAL** **            END** **Previewer   PrintPreviewClass           !declare Previewer object** **                                        ! for use with ThisProcedure** **  CODE** **  ThisProcedure.Run()                   !run the report procedure** **ThisProcedure.Init  PROCEDURE()         !initialize ThisProcedure** **ReturnValue      BYTE,AUTO** **  CODE** **  GlobalErrors.Init** **  Relate:Customer.Init** **  ReturnValue = PARENT.Init()** **  SELF.FirstField = ?PctDone** **  SELF.VCRRequest &= VCRRequest** **  SELF.Errors &= GlobalErrors           !set error handler for ThisProcedure** **  Relate:Customer.Open                  !open Customer & related files** **  OPEN(ProgressWindow)** **  SELF.Opened=True** **                                        !do report specific initialization** **  CusReport.Init(CusView,Relate:Customer,?TxtDone,PctDone,RECORDS(Customer))** **  CusReport.AddSortOrder(CUS:BYNUMBER)  !set report sort order** **  SELF.AddItem(?Cancel,RequestCancelled)!set action on cancel** **  SELF.Init(CusReport,report,Previewer) !register Previewer & CusReport with** **                                        !ThisProcedure** **  SELF.Zoom = PageWidth** **  Previewer.AllowUserZoom=True          !allow custom zoom factors** **  Previewer.Maximize=True               !initially maximize preview window** **  SELF.SetAlerts()                      !alert keys for ThisProcedure** **  RETURN ReturnValue** **ThisProcedure.Kill  PROCEDURE()         !shut down ThisProcedure** **ReturnValue      BYTE,AUTO** **  CODE** **  ReturnValue = PARENT.Kill()           !call base class shut down** **  Relate:Customer.Close                 !close Customer & related files** **  Relate:Customer.Kill                  !shut down Relate:Customer object** **  GlobalErrors.Kill                     !shut down GlobalErrors object** **  RETURN ReturnValue** **CusReport.TakeRecord PROCEDURE()        !do any per record process** **ReturnValue      BYTE,AUTO** **SkipDetails      BYTE** **  CODE** **  ReturnValue = PARENT.TakeRecord()     !standard process for each record** **  PRINT(RPT:detail)                     !print detail for each record** **  RETURN ReturnValue** **Access:Customer.Init PROCEDURE** **  CODE** **  PARENT.Init(Customer,GlobalErrors)** **  SELF.FileNameValue = 'Customer'** **  SELF.Buffer &= CUS:Record** **  SELF.Create = 0** **  SELF.LazyOpen = False** **  SELF.AddKey(CUS:BYNUMBER,'CUS:BYNUMBER',0)** **Relate:Customer.Init PROCEDURE** **  CODE** **  Access:Customer.Init** **  PARENT.Init(Access:Customer,1)**