Applicable Versions: 5.00.0050 and above
It is possible to access all the various properties of the DataPA System elements (Systems and their Connections) using an API class added in DataPA OpenAnalytics 5.00.0050. This is called the QueryEngine and it is documented here.
You can retrieve a specific connection using the System name and Connection name with the following Progress ABL code:-
/* First define, create and initialise a ClientConfig object (or skip this if you already have one) */ DEFINE VARIABLE chClientConfig AS COM-HANDLE NO-UNDO. CREATE "DataPAClientConfig.ClientConfig" chClientConfig. chClientConfig:Initialise_2(). /* Now define and retrieve the handle for the connection called localhost, in the system sports2000 */ DEFINE VARIABLE chConnection AS COM-HANDLE NO-UNDO. chConnection = chClientConfig:SetupManager:Systems():Item("sports2000"):Connections:Item("localhost"). /* place code to modify the object here */ /* No make sure these changes are flagged to the application */ chClientConfig:SetupManager:RefreshRecordsets(). /* Now tidy up our handles */ RELEASE OBJECT chClientConfig NO-ERROR. RELEASE OBJECT chConnection NO-ERROR. |
Details of the SystemObject class are available here and details of the Connection class are available here. So for example, if I wanted to change the host, port and AppService details for my connection, I could use the following code;
/* First define, create and initialise a ClientConfig object (or skip this if you already have one) */ DEFINE VARIABLE chClientConfig AS COM-HANDLE NO-UNDO. CREATE "DataPAClientConfig.ClientConfig" chClientConfig. chClientConfig:Initialise_2(). /* Now define and retrieve the handle for the connection called localhost, in the system sports2000 */ DEFINE VARIABLE chConnection AS COM-HANDLE NO-UNDO. chConnection = chClientConfig:SetupManager:Systems():Item("sports2000"):Connections:Item("localhost"). /* place code to modify the object here */ chConnection:Host = "192.168.1.19". chConnection:Service = "5169". chConnection:AppService = "sports2k". /* No make sure these changes are flagged to the application */ chClientConfig:SetupManager:RefreshRecordsets(). /* Now tidy up our handles */ RELEASE OBJECT chClientConfig NO-ERROR. RELEASE OBJECT chConnection NO-ERROR. |