Kbase P43932: How to get the Connection Properties of a Crystal report at runtime using ActiveX
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  08/09/2009 |
|
Status: Verified
GOAL:
How to get the Connection Properties of a Crystal report at runtime using ActiveX
GOAL:
How to get the Connection Properties of a report using the Crystal RDC
GOAL:
Crystal Reports 9: How to get the connection properties at runtime using ActiveX
GOAL:
Crystal Reports 10: How to get the connection properties at runtime using ActiveX
GOAL:
Crystal Reports XI: How to get the connection properties at runtime using ActiveX
GOAL:
How to get connection properties for Crystal Reports?
FACT(s) (Environment):
Progress 9.1D
Progress 9.1E
OpenEdge 10.x
Windows
Crystal Reports
FIX:
To get the name and values of the ConnectionProperty object, you need to use the ConnectBufferString property of the DatabaseTable object. The result should then be parsed to obtain the name and value for each property. The following code illustrates this:
DEFINE VARIABLE chCRApplication AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chCRDocument AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chCRTable AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE yy AS INTEGER NO-UNDO.
DEFINE VARIABLE xx AS INTEGER NO-UNDO.
DEFINE VARIABLE p1 AS CHARACTER NO-UNDO.
DEFINE VARIABLE p2 AS CHARACTER NO-UNDO.
DEFINE VARIABLE p3 AS CHARACTER NO-UNDO.
DEFINE VARIABLE p4 AS CHARACTER NO-UNDO.
DEFINE VARIABLE creport AS CHARACTER NO-UNDO.
CREATE "CrystalRuntime.Application" chCRApplication .
creport = SEARCH ( 'report.rpt' ) .
chCRDocument = chCRApplication:OpenReport( creport, 1) .
DO yy = 1 TO chCRDocument:DATABASE:tables:COUNT :
chCRTable = chCRDocument:DATABASE:tables( yy ).
p1 = REPLACE(chCRTable:ConnectBufferString, ";;", ";").
DO xx = 1 TO chCRTable:ConnectionProperties:COUNT :
p2 = ENTRY(xx, p1, ";").
p3 = ENTRY(1, p2, "=").
/* Use this one to display the property value */
/* p4 = ENTRY(2, p2, "="). */
/*********************************************/
/* Or use this one to display the value */
IF LOOKUP("Password", p3, " ") = 0 THEN
p4 = chCRTable:ConnectionProperties:ITEM(p3):VALUE.
ELSE
p4 = "".
IF p4 = ? THEN p4 = "".
/***************************************/
MESSAGE chCRTable:NAME SKIP(2) p3 + " = " + p4
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
RELEASE OBJECT chCRTable.
END.
RELEASE OBJECT chCRDocument.
RELEASE OBJECT chCRApplication.