RpReport:Init() - Designer Mode Method

<< Click to Display Table of Contents >>

Navigation:  RpReport Class >

RpReport:Init() - Designer Mode Method

Previous pageReturn to chapter overviewNext page

(Linkable Design Library Only)

 

Purpose

Construct a RpReport Designer object.

Syntax

RpReport{oOwner, aTables, cDataPath, aDbfSwap}  SELF

Syntax - Report Wizards

CrossTabReportWizard(oOwner, aTables)  oRpReport

StandardReportWizard(oOwner, aTables)  oRpReport

LabelReportWizard(oOwner, aTables)  oRpReport

 

Arguments

oOwnerThe window that owns the RpReport design window
aTablesAn array containing the tables that the user can include in the report.  The tables must be specified when the RpReport object is created. The format of the array is:

 

       {{cFileName, cTableName, cDriver, lODBC}, {...}, ...}

 

CFileName

The file name of the RDD table or the SQL table name.

CTableName

The table name that the user will see when they choose the table.

CDriver

For RDD tables, this is the driver name ("DBFCDX", "DBFNTX").  For SQL Queries, it identifies the ODBC connection name ("SAMPLE").

lODBC

Logical indicating if the report is ODBC based.  (TRUE = ODBC)

cDatapathOptional path for the database.  This parameter will override the table path(s) stored in the report file.  This parameter applies only to RDD tables.
aDbfSwapAllows you to swap out the tables used in the report.  While this parameter applies primarily to RDD tables, it can also be used to substitute tables in a SQL query.  

Any value of the array that you do not wish to change should be specified as NIL.  If you specify NULL_STRING, the value will be changed to the empty string value.

The format of the array is:

 
       {{RPAlias, Table File, Index File, Index Tag, RDD, RDDAlias}, {...}, ...}

 

RPAlias

The alias which ReportPro has assigned to the table.  This character value can be found in the Setup Sections dialog.  This is the key used to designate which table in the data set is being replaced so it must exactly match the ReportPro alias.

Table File

The complete path and file name of the substituted table.

Index File

The index file to use in place of the index filename specified in the Setup Sections dialog.

Index Tag

The index tag used in conjunction with the Index File specified above. If the Index File is specified, you must specify a Tag for DBFCDX and DBFMDX RDDs.

RDD

The RDD to use with this table.

RDDAlias

When specified, this element forces ReportPro to use an already open DBF table instead of opening the one specified in the report.  This element can be the alias name, the work area number or the DBServer of the already open table.

 

Description

When an array is specified as the second parameter of the RpReport:Init(), the RpReport object initializes as a report designer window.  The report designer initialization is a two step process.  First you instantiate the RpReport object by specifying the array of tables the user can include in the report.  Next you must call: NewCrossTabRpt(), NewLabelRpt(), NewRpt() or LoadRpt() to complete the initialization.

 

The RpReport object can also be instantiated by calling one of the three Report Wizard functions: CrossTabReportWizard(), LabelReportWizard(), and StandardReportWizard().  The Report Wizard functions guide the user through the creation of a report through a tabbed dialog.

Example
       In addition to the code below, please see the Designer Example program which accompanies ReportPro.

METHOD NewReport CLASS StandardShellWindow

 

  LOCAL oReport AS RpReport

  LOCAL aDBS[0] AS ARRAY

 

  AADD(aDbs,{"parcels.dbf","Parcels Table","DBFNTX",FALSE})

  AADD(aDbs,{"district.dbf","District Table","DBFNTX",FALSE})

 

  // initialize RpReport as the designer...

  oReport:=RpReport{SELF,aDbs}

  // initialize the designer for a new report

  oReport:NewRpt()

  IF oReport:IsValid

    AADD(SELF:aChildWindows, oReport)

  ELSE

    oReport:EndWindow()

  ENDIF

 

METHOD OpenReport CLASS StandardShellWindow

 

  LOCAL oReport AS RpReport

  LOCAL aDBS[0] AS ARRAY

  LOCAL oDialog AS OpenDialog

      

  AADD(aDbs,{"parcels.dbf","Parcels Table","DBFNTX",FALSE})

  AADD(aDbs,{"district.dbf","District Table","DBFNTX",FALSE})

 

  (oDialog:=OpenDialog{SELF,"*.RPT"}):Show()

  IF !EMPTY(oDialog:Filename)

 

    // initialize RpReport as the designer...

    oReport:=RpReport{SELF,aDbs}

 

    // load the report from file...

    oReport:LoadRpt(oDialog:Filename)

    IF oReport:IsValid

      AADD(SELF:aChildWindows, oReport)

    ELSE

      oReport:EndWindow()

    ENDIF

  ENDIF