Progress
Report Builder
Deployment Guide


Generating a List of Reports, Printing the Reports, and Updating the RB-STATUS Field

The rbplist1.p sample procedure runs all the reports in the rbsample.prl report library and updates the RB-STATUS field. This procedure assumes that all of the reports in the list generated by _getname.p use the Sports database. Report Engine connects to the Sports database only once on startup, and the same connection is used for each report since the ’=>’ syntax is used in the RB-DB-CONNECTION field of the RBREPORT table.

To run the rbplist1.p procedure with the rbsample.prl report library, execute the following command:

RUN rblist1.p("c:\dlc\src\aderb\rbsample.prl"). 

Here is the rbplist1.p procedure:

rbplist1.p
/*1/ 
  DEF VAR report-list AS CHARACTER INITIAL "".
  DEF VAR report-count AS INTEGER INITIAL 0.
  DEF VAR report-number AS INTEGER INITIAL 0.
  DEF VAR current-report-name AS CHARACTER INITIAL "".

/* 2 */ 
  DEF INPUT PARAMETER report-library AS CHARACTER.

/* 3 */ 
  RUN aderb/_getname.p(report-library, OUTPUT report-list, 
    OUTPUT report-count).

/* 4 */ 
  REPEAT report-number = 1 TO report-count:

    CREATE RBreport.

    current-report-name = ENTRY(report-number, report-list).

    ASSIGN 
      RBREPORT.RB-REPORT-LIBRARY = report-library
      RBREPORT.RB-REPORT-NAME = current-report-name
      RBREPORT.RB-DB-CONNECTION = "sports => logsport"
      RBREPORT.RB-PRINT-DESTINATION = "D"
      RBREPORT.RB-DISPLAY-STATUS = yes
      RBREPORT.RB-DISPLAY-ERRORS = yes. 

    RELEASE RBREPORT.

  END.

/* 5 */ 
  RUN aderb\_prore.p(false,"-db Runtable -S servername -H hostname 
    -N networktype -db c:\data\sports -1 -ld logsport -rbupds").  

/* 6 */ 
  FOR EACH RBREPORT:

    MESSAGE "Status of Report ’" + RBREPORT.RB-REPORT-NAME + 
      "’: " + RBREPORT.RB-STATUS VIEW-AS ALERT-BOX.

    DELETE RBREPORT.

  END. 

The commented numbers correspond to the following step-by-step descriptions:

  1. Define the variables used in the procedure.
  2. Define the input parameter to the procedure.
  3. Run _getname.p to generate a list of reports in the specified library.
  4. Add the reports to the Runtable database.
  5. Run each report record in the RBREPORT table using the connection to the database on the command line. Then, update the RB-STATUS field.
  6. For each record, view RB-STATUS field as an Alert Box, then delete the record.

Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095