Consultor Eletrônico



Kbase P12602: RB: how to pass a filter to the Report Engine using RB-OTHER
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/30/2003
Status: Verified

GOAL:

How to pass a filter to the Report Engine using RB-OTHER-PARAMETERS.

FACT(s) (Environment):

Progress 8.x

FACT(s) (Environment):

Progress 9.x

FIX:

Here is a sample on how to pass a filter to the Report Engine using RB-OTHER-PARAMETERS.
The filter works on sports.customer and is:

cust-num < myVar

In the 4GL procedure call the Report Engine with this parameters:



DEFINE VARIABLE myVar AS INTEGER    NO-UNDO.
myVar = 30.

run aderb/_prntrb2.p ("<PRLpath>\REPORTS.PRL",
"Customer",       /* rb-report-name */
"sports=-db <DBpath>\sports -1 -RO",  /* rb-db-connection */
"S",                       /* RB-INCLUDE-RECORDS */
"",                        /* rb-filter */
"",                        /* rb-memo-file */
"D",                   /* rb-print-destination */
"",                    /* rb-printer-name      */
"",                    /* rb-printer-port      */
"",                    /* rb-output-file */
1,                     /* rb-number-copies */
0,                     /* rb-begin-page */
999,                   /* rb-end-page */
FALSE,                 /* rb-test-pattern */
"Customer",            /* rb-window-title */
TRUE,                 /* rb-display-errors */
FALSE,                 /* rb-display-status */
TRUE,                  /* rb-no-wait */
"limit = " + string(myVar), /* RB-OTHER-PARAMETERS */
"status.txt"). /* rb-status-file */


Note that RB-INCLUDE-RECORDS = "S", so the report is ran using the filter saved in the report definition.

In Report Builder create a Calculated Field, let's call it lPrint:

IIF(Cust-Num <=  (NUMERIC(RUNTIME-PARAMETER("limit"))),YES,NO)

lPrint will be YES if Cust-Num is <= of myVar, otherwise NO. Note that a numeric cast is needed as the RUNTIME-PARAMETER is always a char type.

Now go to
Report Builder-> Database-> Filter
and insert a filter:

lPrint = YES.

By printing the report, only the record that matches the condition will displayed.