Kbase 16016: How to Override the DB connection with a variable in RB.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
How to Override the DB connection with a variable in RB.
This following example shoes how to pass a DB override string
to the report engine (_printrb interface) using a variable.
DEFINE VARIABLE nettype AS CHARACTER.
DEFINE VARIABLE hostname AS CHARACTER.
DEFINE VARIABLE servername AS CHARACTER.
DEFINE VARIABLE db-connection AS CHARACTER.
ASSIGN nettype = "-N TCP "
hostname = "-H tssun4-26 "
servername = "-S brkr078 ".
/* You could have gotten this information by
prompting the user or from an outside source
then assigned it to the variables */
ASSIGN db-connection = "-db dbname.db " + nettype + hostname
+ servername.
/* You could use one variable if the information
is not going to change -
ASSIGN db-connection =
"-db dbname.db -N TCP -H tssun4-26 -S brkr078".
Or use pieces -
ASSIGN db-connection =
"-db dbname.db " + nettype + " -H tssun4-26 -S brkr078"
*/
RUN aderb/_printrb.p
("c:\work\reports.prl", /* RB-REPORT-LIBRARY */
"Customer List", /* RB-REPORT-NAME */
db-connection, /* RB-DB-CONNECTION */
"", /* 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, /* no quotes */ /* RB-BEGIN-PAGE */
999, /* no quotes */ /* RB-END-PAGE */
no, /* RB-TEST-PATTERN */
"", /* RB-WINDOW-TITLE */
yes, /* RB-DISPLAY-ERRORS */
yes, /* RB-DISPLAY-STATUS */
no, /* RB-NO-WAIT */
"") /*RB-OTHER-PARAMETERS */
If you wish to use the complete override functionality added
to V8 (described on path 3-9 of the RB Deployment Guide),
replace the RB-DB-CONNECTION parameter like in the following
example. Sports is the logical name of the DB saved in the
report.
RUN aderb/_printrb.p
("c:\work\reports.prl", /* RB-REPORT-LIBRARY */
"Customer List", /* RB-REPORT-NAME */
"sports=" + db-connection, /* RB-DB-CONNECTION */
"", /* 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, /* no quotes */ /* RB-BEGIN-PAGE */
999, /* no quotes */ /* RB-END-PAGE */
no, /* RB-TEST-PATTERN */
"", /* RB-WINDOW-TITLE */
yes, /* RB-DISPLAY-ERRORS */
yes, /* RB-DISPLAY-STATUS */
no, /* RB-NO-WAIT */
"") /* RB-OTHER-PARAMETERS */
Progress Software Technical Support Note # 16016