Applicable Versions: 5.00.0038 Onwards (For earlier versions see below)


If you have embedded DataPA OpenAnalytics into your own software, it is preferable to not have to apply a license key to each individual machine when you deploy to your customer site. As such, yo9u may wish to apply the license programmatically. 


The ClientConfig object has a LicenseInfo property, which exposes a LicenseInfo object. Call the ApplyLicense method on this object BEFORE you call the initialise method on the ClientConfig object. The ApplyLicense method will apply the license for the current session only. If you want to persist the license to the machine, overwriting any previous license that may have been applied, you can call the PersistCurrentLicenseOnClient method.


ABL Syntax
DEFINE VARIABLE chClientConfig AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chSessionData AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chDataPA AS COM-HANDLE NO-UNDO.

CREATE ""DataPA.SessionData"" chSessionData.
chSessionData:value(""DelayInitialise"") = True.

CREATE ""DataPAClientConfig.ClientConfig"" chClientConfig.
chClientConfig:LicenseInfo:ApplyLicense(""0000000001"", ""C51713FA2486AA8394888DFD"", ""John Smith"", ""Acme Corp""). 

CREATE ""DataPA.Application"" chDataPA.
chDataPA:ClientConfig = chClientConfig.
chDataPA:Initialise().


VB.NET Syntax
Dim SessionData As New DataPA.SessionData
SessionData.value(""DelayInitialise"") = True

Dim ClientConfig As New DataPAClientConfig.ClientConfig
ClientConfig.LicenseInfo.ApplyLicense(""0000000001"", ""C51713FA2486AA8394888DFD"", ""John Smith"", ""Acme Corp"")

Dim DataPA As New DataPA.Application
DataPA.ClientConfig = ClientConfig
DataPA.Initialise()


Progress .NET For GUI Syntax
DEFINE VARIABLE clientConfig AS DataPAClientConfig.ClientConfig.
DEFINE VARIABLE SessionData AS DataPA.SessionData.
DEFINE VARIABLE DataPAApplication AS DataPA.Application.

SessionData = NEW DataPA.SessionDataClass().
SessionData:SetComValue(""DelayInitialise"", ""True"").

clientConfig = NEW DataPAClientConfig.ClientConfig().
clientConfig:LicenseInfo:ApplyLicense(""0000000001"", ""C51713FA2486AA8394888DFD"", ""John Smith"", ""Acme Corp""). 

DataPAApplication = NEW DataPA.ApplicationClass().
DataPAApplication:ClientConfig = clientConfig.
DataPAApplication:Initialise().


Applicable Versions: 4.00.0172 to 4.05.0000 (for later versions see KB)


If you are applying security details from an AppServer, this can be achieved using the PAGetSecData.p server side procedure


However, if you are not applying security setting from the AppServer, you can apply a license key from your code.


The license is checked immediately when any DataPA object is created. As such, you must execute this code before creating any other DataPA object in order to prevent the license screen from appearing.


The AdminObj object provides a property and method that allow us to manipulate the license applied to a particular machine. The SerialNumber property is a read-only property that returns the serial number of the license currently applied to the machine. If no license has been applied, it will return blank. As such, we can use this property to test for an existing license so we do not overwrite it. The ApplyLicense method allows us to apply a license. It takes four input parameters, the licensed username, the licensed organisation, the serial number and the license key.


Thus, the code to programmatically apply a license key should be as follows:


ABL Syntax
DEFINE VARIABLE chAdminObj AS COM-HANDLE NO-UNDO.
CREATE ""DataPA.AdminObj"" chAdminObj.
/* Check if licensed */
IF chAdminObj:SerialNumber = """" THEN DO:
  chAdminObj:ApplyLicense(""John Smith"", ""Acme Corp"", ""0000000001"", ""C51713FA2486AA8394888DFD"").
END.
RELEASE OBJECT chAdminObj.


VB.NET Syntax
Dim AdminObj As New DataPA.AdminObj
' Check if licensed
IF AdminObj.SerialNumber = """" Then
  chAdminObj.ApplyLicense(""John Smith"", ""Acme Corp"", ""0000000001"", ""C51713FA2486AA8394888DFD"")
End If
AdminObj = Nothing

Progress .NET For GUI Syntax

DEFINE VARIABLE AdminObj AS DataPA.AdminObjClass.
ASSIGN AdminObj = NEW DataPA.AdminObjClass().
/* Check if licensed */
IF AdminObj:SerialNumber = """"  THEN DO:
  AdminObj:ApplyLicense(""John Smith"", ""Acme Corp"", ""0000000001"", ""C51713FA2486AA8394888DFD"").
END.
AdminObj = ?.