Progress
Report Builder
Deployment Guide


Running Multiple Reports and Prompting for User Input

In the following example, rbprompt.p, you prompt the user to specify whether to generate each report in the rbsample.prl report library.

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

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

Here is the rbprompt.p procedure:

rbprompt.p
/* 1 */ 
  DEF VAR RB-REPORT-NAME AS CHARACTER INITIAL "".
  DEF VAR RB-DB-CONNECTION AS CHARACTER INITIAL "".
  DEF VAR RB-INCLUDE-RECORDS AS CHARACTER INITIAL "".
  DEF VAR RB-FILTER AS CHARACTER INITIAL "".
  DEF VAR RB-MEMO-FILE AS CHARACTER INITIAL "".
  DEF VAR RB-PRINT-DESTINATION AS CHARACTER INITIAL "".
  DEF VAR RB-PRINTER-NAME AS CHARACTER INITIAL "".
  DEF VAR RB-PRINTER-PORT AS CHARACTER INITIAL "".
  DEF VAR RB-OUTPUT-FILE AS CHARACTER INITIAL "".
  DEF VAR RB-NUMBER-COPIES AS INTEGER INITIAL 1.
  DEF VAR RB-BEGIN-PAGE AS INTEGER INITIAL 0.
  DEF VAR RB-END-PAGE AS INTEGER INITIAL 0.
  DEF VAR RB-TEST-PATTERN AS LOGICAL INITIAL no.
  DEF VAR RB-WINDOW-TITLE AS CHARACTER INITIAL "".
  DEF VAR RB-DISPLAY-ERRORS AS LOGICAL INITIAL yes.
  DEF VAR RB-DISPLAY-STATUS AS LOGICAL INITIAL yes.
  DEF VAR RB-NO-WAIT AS LOGICAL INITIAL no.
  DEF VAR RB-OTHER-PARAMETERS AS CHARACTER INITIAL "".

  DEF VAR report-list AS CHARACTER.
  DEF VAR report-count AS INTEGER.
  DEF VAR report-number AS INTEGER.

/* 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:

    RB-REPORT-NAME = ENTRY (report-number, report-list).

    MESSAGE "Report Number " + string (report-number) + " is " 
      + RB-REPORT-NAME + ". Do you want to print it?"
      VIEW-AS ALERT-BOX QUESTION BUTTONS yes-no UPDATE user-answer.

    IF (user-answer) THEN
      RUN aderb/_printrb.p (report-library,
        RB-REPORT-NAME,
        RB-DB-CONNECTION,
        RB-INCLUDE-RECORDS,
        RB-FILTER,
        RB-MEMO-FILE,
        RB-PRINT-DESTINATION,
        RB-PRINTER-NAME,
        RB-PRINTER-PORT,
        RB-OUTPUT-FILE,
        RB-NUMBER-COPIES,
        RB-BEGIN-PAGE,
        RB-END-PAGE,
        RB-TEST-PATTERN,
        RB-WINDOW-TITLE,
        RB-DISPLAY-ERRORS,
        RB-DISPLAY-STATUS,
        RB-NO-WAIT,
        RB-OTHER-PARAMETERS).
    END. 

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

  1. Define variables for the report parameters.
  2. Define the input parameter for the library name.
  3. Define the user-answer variable to handle the user’s input.
  4. Run _getname.p to generate a list of reports in the rbsample.prl library.
  5. Prompt the user to specify which reports to print, and print the reports.
NOTE: If you are using the PRNTRB2 interface you must modify the procedure to run aderb\_prntrb2 and include the RB-STATUS-FILE parameter.


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