Progress
Report Builder
Deployment Guide


Generating a List of Reports, Prompting the User to Select Which Reports to Run, and Running the Reports

The rblist2.p sample procedure generates a list of all the reports in the rbsample.prl report library, prompts the user to specify which reports to run, then runs the reports. This procedure assumes that all of the reports in the list generated by _getname.p use the Sports database. Report Engine connects to the 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 rblist2.p procedure with the rbsample.prl report library, execute the following command:

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

Here is the rbplist2.p procedure:

rbplist2.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 */ 
  DEF VAR user-answer AS LOGICAL.

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

/* 5 */ 
  DO report-number = 1 TO report-count: 

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

    MESSAGE  "Report Number" +  STRING(report-number) + " is ’" 
      + current-report-name + "’.  Do you want to print it?"
      VIEW-AS  ALERT-BOX  QUESTION  BUTTONS  yes-no  
      UPDATE  user-answer.

    IF (user-answer) THEN DO TRANSACTION:

      CREATE RBREPORT.

      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.   
  END.

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

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. Define the user-answer variable to handle the user’s input.
  4. Run _getname.p to generate a list of reports in the specified library.
  5. Prompt the user and add the selected reports to the Runtable database.
  6. Run the selected reports, then delete the table records.

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