Yes, you can store the DataPA configuration in a database. This allows you to completely control, based on the user, which connections, subjects, subject fields, links and lookups they have access to.


In order to achieve this you need to follow the steps below.


If you are starting with the default DataPA setup configuration then the DataPA configuration will be stored in a set of .dat files. The location of these dat files will be determined by the Data Location that has been set on the DataPA Security screen. The Security screen can be accessed from the menu in DataPA by selecting Setup > Security.


The first step you need to do is to create the database tables that you want to use to store the configuration information. You can define these yourself by they must contain a field for each item that is part of the DataPA configuration.


These are:


Item
Stores information for
No. fields
DataPAPartitions
DataPA Systems and connections
27
DataPA Links
DataPA Links
8
DataPASDOs
DataPA SDO’s and Business Logic procedures
3
DataPALookups
DataPA Lookups
14
DataPAConditions
DataPA Conditions
22
DataPA Subjects
DataPA Subjects
11
DataPA Subject Fields
DataPA Subject Fields
1


A .df file is available to download here for both V9 and V10 version of these tables.



Version
File
V9
datapadbV9.df
V10
datapadbV10.df


Once the database tables have been created you need to write two hook procedures in order to allow you to control how the DataPA configuration information is written and read to and from the database tables you have created. These hook procedures need to be in the PROPATH of the AppServer that you want to use to store the files in the database.


The procedure that allows you to control how information is written to the database tables is called PADBStoreFile.p. This procedure presents the DataPA configuration in a set of Temp Table’s and then you can code it to store the information in the database tables.


The code below shows how this produce would be coded to store the information in the database tables that are defined in the example df’s mentioned above:




/*------------------------------------------------------------------------
File : PADBStoreFile.p
Syntax : Run PADBStoreFile.p (INPUT <User Name>,
INPUT <File Name>,
INPUT TABLE <ttPartitions Temp Table>,
INPUT TABLE <ttLinks Temp Table>,
INPUT TABLE <ttConditions Temp Table>,
INPUT TABLE <ttLookups Temp Table>,
INPUT TABLE <ttSDOs Temp Table>,
INPUT TABLE <ttSubjects Temp Table>,
INPUT TABLE <ttSubjectFields Temp Table>,
OUTPUT <Success Flag>)

Description : This program will give administrators the opportunity to
store DataPA setup file to the database
Author(s) : Gary Lamb
Created : 21/10/10
Notes :

Copyright © 2010 by DataPA Limited, 15 Pitreavie court, Dunfermline, UK
and other contributors as listed below. All Rights Reserved.
------------------------------------------------------------------------
Amendments
==========

Date Author Description
======== ============== ==============================================
------------------------------------------------------------------------ */
DEFINE TEMP-TABLE ttPartitions NO-UNDO
FIELD cName AS CHARACTER
FIELD cDescription AS CHARACTER
FIELD cHost AS CHARACTER
FIELD cService AS CHARACTER
FIELD cAppService AS CHARACTER
FIELD cURL AS CHARACTER
FIELD cAppServerInfo AS CHARACTER
FIELD bPromptUser AS LOGICAL
FIELD bDirect AS LOGICAL
FIELD bDynamicsSec AS LOGICAL
FIELD bMultiLevel AS LOGICAL
FIELD cConnectionName AS CHARACTER
FIELD bPrimary AS LOGICAL
FIELD cTimeOut AS INTEGER
FIELD cType AS CHARACTER
FIELD cDecimalSeparator AS CHARACTER
FIELD cThousandSeparator AS CHARACTER
FIELD bAdmin AS LOGICAL
FIELD bLookupEdit AS LOGICAL
FIELD bUSeSSL AS LOGICAL
FIELD bSessionFree AS LOGICAL
FIELD bClientServer AS LOGICAL
FIELD bEnableTracing AS LOGICAL
FIELD iLoggingLevel AS INTEGER
FIELD cLogFile AS CHARACTER
FIELD iTCPClientRetry AS INTEGER
FIELD iTCPClientRetryInterval AS INTEGER
FIELD bEnableCompression AS LOGICAL
FIELD iCompressionThreshold AS INTEGER
FIELD iCompressionLevel AS INTEGER
INDEX i1 AS PRIMARY cName cConnectionName.
DEFINE TEMP-TABLE ttLinks NO-UNDO
FIELD cID AS CHARACTER
FIELD cSystemName AS CHARACTER
FIELD cDescription AS CHARACTER
FIELD cSourceTableName AS CHARACTER
FIELD cTargetTableName AS CHARACTER
FIELD cJoinQueryString AS CHARACTER
FIELD bInnerJoin AS LOGICAL
FIELD bPrimary AS LOGICAL
INDEX i1 AS PRIMARY cID.
DEFINE TEMP-TABLE ttLookups NO-UNDO
FIELD cUniqueID AS CHARACTER
FIELD cSystemName AS CHARACTER
FIELD cLookupName AS CHARACTER
FIELD cTable AS CHARACTER
FIELD cQueryString AS CHARACTER
FIELD cIndexField AS CHARACTER
FIELD cDescriptionField AS CHARACTER
FIELD cCalcFields AS CHARACTER
FIELD bCache AS LOGICAL
FIELD iVersion AS INTEGER
FIELD bIgnoreBlanks AS LOGICAL
FIELD bIgnoreDuplicates AS LOGICAL
FIELD bSort AS LOGICAL
FIELD bMultipleSelect AS LOGICAL
INDEX i1 AS PRIMARY cUniqueID.
DEFINE TEMP-TABLE ttConditions NO-UNDO
FIELD cUniqueID AS CHARACTER
FIELD cSystemName AS CHARACTER
FIELD cParentType AS CHARACTER
FIELD cParentID AS CHARACTER
FIELD iIndex AS INTEGER
FIELD cDataType AS CHARACTER
FIELD cLogicalOperator AS CHARACTER
FIELD cTargetTable AS CHARACTER
FIELD cTargetField AS CHARACTER
FIELD cOperator AS CHARACTER
FIELD cSourceTable AS CHARACTER
FIELD cSourceField AS CHARACTER
FIELD cExpression AS CHARACTER
FIELD bUseExpression AS LOGICAL
FIELD iStartGroup AS INTEGER
FIELD iEndGroup AS INTEGER
FIELD cLabel AS CHARACTER
FIELD cDescription AS CHARACTER
FIELD bPrompt AS LOGICAL
FIELD bMandatory AS LOGICAL
FIELD cFormat AS CHARACTER
FIELD cFunctionLookup AS CHARACTER
INDEX i1 AS PRIMARY cUniqueID.
DEFINE TEMP-TABLE ttSDOs NO-UNDO
FIELD cSystemName AS CHARACTER
FIELD cSDOName AS CHARACTER
FIELD bDynamic AS LOGICAL
INDEX i1 AS PRIMARY cSystemName cSDOName.
DEFINE TEMP-TABLE ttSubjects NO-UNDO
FIELD cID AS CHARACTER
FIELD cTitle AS CHARACTER
FIELD cSystemName AS CHARACTER
FIELD cDescription AS CHARACTER
FIELD cSmartDataObject AS CHARACTER
FIELD cTables AS CHARACTER
FIELD cParents AS CHARACTER
FIELD cIndexes AS CHARACTER
FIELD cLinks AS CHARACTER
FIELD bDynamic AS LOGICAL FORMAT "true/false"
INDEX i1 AS PRIMARY cID.
DEFINE TEMP-TABLE ttSubjectFields NO-UNDO
FIELD cID AS CHARACTER
FIELD cTitle AS CHARACTER
FIELD cFieldName AS CHARACTER
FIELD cDataType AS CHARACTER
FIELD cLabel AS CHARACTER
FIELD cFormat AS CHARACTER
FIELD lAllowIndex AS LOGICAL
FIELD lAllowSort AS LOGICAL
FIELD lAllowContains AS LOGICAL
FIELD iExtent AS INTEGER
FIELD iWidth AS INTEGER
FIELD cExpression AS CHARACTER
FIELD cSvrFormat AS CHARACTER
FIELD cLookup AS CHARACTER
FIELD cBuffer AS CHARACTER
INDEX i1 AS PRIMARY cID cFieldName.
DEFINE INPUT PARAMETER ipcUserName AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER ipcFileName AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER TABLE FOR ttPartitions.
DEFINE INPUT PARAMETER TABLE FOR ttLinks.
DEFINE INPUT PARAMETER TABLE FOR ttConditions.
DEFINE INPUT PARAMETER TABLE FOR ttLookups.
DEFINE INPUT PARAMETER TABLE FOR ttSDOs.
DEFINE INPUT PARAMETER TABLE FOR ttSubjects.
DEFINE INPUT PARAMETER TABLE FOR ttSubjectFields.
DEFINE OUTPUT PARAMETER oplSuccess AS LOGICAL.
DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
DEFINE VARIABLE hBuffer AS HANDLE NO-UNDO.
DEFINE VARIABLE hBufferField AS HANDLE NO-UNDO.
DEFINE VARIABLE iCount AS INTEGER NO-UNDO.
DEFINE VARIABLE iCount1 AS INTEGER NO-UNDO.
DEFINE VARIABLE lError AS LOGICAL NO-UNDO.
CASE ipcFileName:

/* Systems / Connections */
WHEN "DB.Partitions.dat" THEN DO:
/* Do stuff - save ttPartitions records to the database */
FOR EACH DataPAPartitions: DELETE DataPAPartitions. END.
FOR EACH ttPartitions:
CREATE DataPAPartitions.
BUFFER-COPY ttPartitions to DataPAPartitions.
END.
END.
/* Links */
WHEN "DB.Links.dat" THEN DO:
/* Do stuff - save ttLinks records to the database */
FOR EACH DataPALinks: DELETE DataPALinks. END.
FOR EACH ttLinks:
CREATE DataPALinks.
BUFFER-COPY ttLinks to DataPALinks.
END.
END.
/* Lookups */
WHEN "DB.Lookups.dat" THEN DO:
/* Do stuff - save ttLookups records to the database */
FOR EACH DataPALookups: DELETE DataPALookups. END.
FOR EACH ttLookups:
CREATE DataPALookups.
BUFFER-COPY ttLookups to DataPALookups.
END.
END.
/* SDOs */
WHEN "DB.SDOs.dat" THEN DO:
/* Do stuff - save ttSDOs records to the database */
FOR EACH DataPASDOs: DELETE DataPASDOs. END.
FOR EACH ttSDOs:
CREATE DataPASDOs.
BUFFER-COPY ttSDOs to DataPASDOs.
END.
END.
/* Subjects */
WHEN "DB.Subjects.dat" THEN DO:
/* Do stuff - save ttsubjects and ttsubjectfields records to the database */
FOR EACH DataPASubjects: DELETE DataPASubjects. END.
FOR EACH DataPASubjectFields: DELETE DataPASubjectFields. END.
FOR EACH ttSubjects:
CREATE DataPASubjects.
BUFFER-COPY ttSubjects to DataPASubjects.
FOR EACH ttSubjectFields WHERE ttSubjectFields.cID = ttSubjects.cID:
CREATE DataPASubjectFields.
BUFFER-COPY ttSubjectFields to DataPASubjectFields.
END.
END.
END.
/* Conditons */
WHEN "DB.Conditions.dat" THEN DO:
/* Do stuff - save ttConditions records to the database */
FOR EACH DataPAConditions: DELETE DataPAConditions. END.
FOR EACH ttConditions:
CREATE DataPAConditions.
BUFFER-COPY ttConditions to DataPAConditions.
END.

END.
END CASE.
oplSuccess = TRUE.
/* EOF */








This procedure will clear the database tables before storing in them the contents of the temp tables passed through by DataPA.


The procedure that allows you to control how information is read from the database tables is called PADBGetFile.p. This procedure allows you to populate a set of Temp Table’s and then uses the contents of those Temp Table’s as the DataPA configuration .


The code below shows how this produce would be coded to store the information in the database tables that are defined in the example df’s mentioned above:



/*------------------------------------------------------------------------
File : PADBGetFile.p
Syntax : Run PADBGetFile.p (INPUT <User Name>,
INPUT <File Name>
OUTPUT <Temp Table 1>
OUTPUT <Temp Table 2>

Description : This program will give administrators the opportunity to
load DataPA setup file from the database
Author(s) : Gary Lamb
Created : 21/10/10
Notes :

Copyright © 2010 by DataPA Limited, 15 Pitreavie court, Dunfermline, UK
and other contributors as listed below. All Rights Reserved.
------------------------------------------------------------------------
Amendments
==========

Date Author Description
======== ============== ==============================================
------------------------------------------------------------------------ */
DEFINE TEMP-TABLE ttPartitions NO-UNDO
FIELD cName AS CHARACTER
FIELD cDescription AS CHARACTER
FIELD cHost AS CHARACTER
FIELD cService AS CHARACTER
FIELD cAppService AS CHARACTER
FIELD cURL AS CHARACTER
FIELD cAppServerInfo AS CHARACTER
FIELD bPromptUser AS LOGICAL
FIELD bDirect AS LOGICAL
FIELD bDynamicsSec AS LOGICAL
FIELD bMultiLevel AS LOGICAL
FIELD cConnectionName AS CHARACTER
FIELD bPrimary AS LOGICAL
FIELD cTimeOut AS INTEGER
FIELD cType AS CHARACTER
FIELD cDecimalSeparator AS CHARACTER
FIELD cThousandSeparator AS CHARACTER
FIELD bAdmin AS LOGICAL
FIELD bLookupEdit AS LOGICAL
FIELD bUseSSL AS LOGICAL
FIELD bSessionFree AS LOGICAL
FIELD bClientServer AS LOGICAL
FIELD bEnableTracing AS LOGICAL
FIELD iLoggingLevel AS INTEGER
FIELD cLogFile AS CHARACTER
FIELD iTcpClientRetry AS INTEGER
FIELD iTcpClientRetryInterval AS INTEGER
FIELD bEnableCompression AS LOGICAL
FIELD iCompressionThreshold AS INTEGER
FIELD iCompressionLevel AS INTEGER
INDEX i1 AS PRIMARY cName cConnectionName.
DEFINE TEMP-TABLE ttLinks NO-UNDO
FIELD cID AS CHARACTER
FIELD cSystemName AS CHARACTER
FIELD cDescription AS CHARACTER
FIELD cSourceTableName AS CHARACTER
FIELD cTargetTableName AS CHARACTER
FIELD cJoinQueryString AS CHARACTER
FIELD bInnerJoin AS LOGICAL
FIELD bPrimary AS LOGICAL
INDEX i1 AS PRIMARY cID.
DEFINE TEMP-TABLE ttLookups NO-UNDO
FIELD cUniqueID AS CHARACTER
FIELD cSystemName AS CHARACTER
FIELD cLookupName AS CHARACTER
FIELD cTable AS CHARACTER
FIELD cQueryString AS CHARACTER
FIELD cIndexField AS CHARACTER
FIELD cDescriptionField AS CHARACTER
FIELD cCalcFields AS CHARACTER
FIELD bCache AS LOGICAL
FIELD iVersion AS INTEGER
FIELD bIgnoreBlanks AS LOGICAL
FIELD bIgnoreDuplicates AS LOGICAL
FIELD bSort AS LOGICAL
FIELD bMultipleSelect AS LOGICAL
INDEX i1 AS PRIMARY cUniqueID.
DEFINE TEMP-TABLE ttConditions NO-UNDO
FIELD cUniqueID AS CHARACTER
FIELD cSystemName AS CHARACTER
FIELD cParentType AS CHARACTER
FIELD cParentID AS CHARACTER
FIELD iIndex AS INTEGER
FIELD cDataType AS CHARACTER
FIELD cLogicalOperator AS CHARACTER
FIELD cTargetTable AS CHARACTER
FIELD cTargetField AS CHARACTER
FIELD cOperator AS CHARACTER
FIELD cSourceTable AS CHARACTER
FIELD cSourceField AS CHARACTER
FIELD cExpression AS CHARACTER
FIELD bUseExpression AS LOGICAL
FIELD iStartGroup AS INTEGER
FIELD iEndGroup AS INTEGER
FIELD cLabel AS CHARACTER
FIELD cDescription AS CHARACTER
FIELD bPrompt AS LOGICAL
FIELD bMandatory AS LOGICAL
FIELD cFormat AS CHARACTER
FIELD cFunctionLookup AS CHARACTER
INDEX i1 AS PRIMARY cUniqueID.
DEFINE TEMP-TABLE ttSDOs NO-UNDO
FIELD cSystemName AS CHARACTER
FIELD cSDOName AS CHARACTER
FIELD bDynamic AS LOGICAL
INDEX i1 AS PRIMARY cSystemName cSDOName.
DEFINE TEMP-TABLE ttSubjects NO-UNDO
FIELD cID AS CHARACTER
FIELD cTitle AS CHARACTER
FIELD cSystemName AS CHARACTER
FIELD cDescription AS CHARACTER
FIELD cSmartDataObject AS CHARACTER
FIELD cTables AS CHARACTER
FIELD cParents AS CHARACTER
FIELD cIndexes AS CHARACTER
FIELD cLinks AS CHARACTER
FIELD bDynamic AS LOGICAL FORMAT "true/false"
INDEX i1 AS PRIMARY cID.
DEFINE TEMP-TABLE ttSubjectFields NO-UNDO
FIELD cID AS CHARACTER
FIELD cTitle AS CHARACTER
FIELD cFieldName AS CHARACTER
FIELD cDataType AS CHARACTER
FIELD cLabel AS CHARACTER
FIELD cFormat AS CHARACTER
FIELD lAllowIndex AS LOGICAL
FIELD lAllowSort AS LOGICAL
FIELD lAllowContains AS LOGICAL
FIELD iExtent AS INTEGER
FIELD iWidth AS INTEGER
FIELD cExpression AS CHARACTER
FIELD cSvrFormat AS CHARACTER
FIELD cLookup AS CHARACTER
FIELD cBuffer AS CHARACTER
INDEX i1 AS PRIMARY cID cFieldName.
DEFINE TEMP-TABLE ttSubjectData NO-UNDO
FIELD cID AS CHARACTER
FIELD cSystemName AS CHARACTER
FIELD cTitle AS CHARACTER
FIELD cDescription AS CHARACTER
FIELD cSmartDataObject AS CHARACTER
FIELD cTables AS CHARACTER
FIELD cParents AS CHARACTER
FIELD cFields AS CHARACTER
FIELD cDataTypes AS CHARACTER
FIELD cLabels AS CHARACTER
FIELD cFormats AS CHARACTER
FIELD cAllowIndex AS CHARACTER
FIELD cAllowSort AS CHARACTER
FIELD cAllowContains AS CHARACTER
FIELD cExtent AS CHARACTER
FIELD cWidth AS CHARACTER
FIELD bDynamic AS LOGICAL FORMAT "true/false"
FIELD cBuffer AS CHARACTER
FIELD cLinks AS CHARACTER
FIELD cIndexes AS CHARACTER
FIELD cExpression AS CHARACTER
FIELD cSvrFormat AS CHARACTER
FIELD cLookups AS CHARACTER
INDEX i1 AS PRIMARY cID.
DEFINE INPUT PARAMETER ipcUserName AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER ipcFileName AS CHARACTER NO-UNDO.
DEFINE OUTPUT PARAMETER TABLE-HANDLE ophTT.
DEFINE OUTPUT PARAMETER TABLE-HANDLE ophTT1.
DEFINE VARIABLE iAllowIndex AS INTEGER NO-UNDO.
DEFINE VARIABLE iAllowSort AS INTEGER NO-UNDO.
DEFINE VARIABLE iAllowContains AS INTEGER NO-UNDO.
DEFINE VARIABLE cBuffer AS CHARACTER NO-UNDO.
CASE ipcFileName:
/* Systems / Connections */
WHEN "DB.Partitions.dat" THEN DO:
/* Do stuff - read from database */
EMPTY TEMP-TABLE ttPartitions.
FOR EACH DataPAPartitions:
CREATE ttPartitions.
BUFFER-COPY DataPAPartitions TO ttPartitions.
END.
ophTT = TEMP-TABLE ttPartitions:HANDLE.
ophTT1 = ?.
END.

/* Links */
WHEN "DB.Links.dat" THEN DO:
/* Do stuff - read from database */
EMPTY TEMP-TABLE ttLinks.
FOR EACH DataPALinks:
CREATE ttLinks.
BUFFER-COPY DataPALinks TO ttLinks.
END.
ophTT = TEMP-TABLE ttLinks:HANDLE.
ophTT1 = ?.
END.

/* Lookups */
WHEN "DB.Lookups.dat" THEN DO:
/* Do stuff - read from database */
EMPTY TEMP-TABLE ttLookups.
FOR EACH DataPALookups:
CREATE ttLookups.
BUFFER-COPY DataPALookups TO ttlookups.
END.
ophTT = TEMP-TABLE ttLookups:HANDLE.
ophTT1 = ?.
END.

/* SDOs */
WHEN "DB.SDOs.dat" THEN DO:
/* Do stuff - read from database */
EMPTY TEMP-TABLE ttSDOs.
FOR EACH DataPASDOs:
CREATE ttSDOs.
BUFFER-COPY DataPASDOs TO ttSDOs.
END.
ophTT = TEMP-TABLE ttSDOs:HANDLE.
ophTT1 = ?.
END.

/* Subjects */
WHEN "DB.Subjects.dat" THEN DO:
/* Do stuff - read from database */
EMPTY TEMP-TABLE ttSubjects.
EMPTY TEMP-TABLE ttSubjectFields.
FOR EACH DataPASubjects:
CREATE ttSubjects.
BUFFER-COPY DataPASubjects TO ttSubjects.
FOR EACH DataPASubjectFields WHERE DataPASubjectFields.cID = DataPASubjects.cID:
CREATE ttSubjectFields.
BUFFER-COPY DataPASubjectfields TO ttSubjectFields.
END.
END.
ophTT = TEMP-TABLE ttSubjects:HANDLE.
ophTT1 = TEMP-TABLE ttSubjectFields:HANDLE.
END.
/* Conditons */
WHEN "DB.Conditions.dat" THEN DO:
/* Do stuff - read from database */
EMPTY TEMP-TABLE ttConditions.
FOR EACH DataPAConditions:
CREATE ttConditions.
BUFFER-COPY DataPAConditions TO ttConditions.
END.
ophTT = TEMP-TABLE ttConditions:HANDLE.
ophTT1 = ?.
END.
END CASE.
/* EOF */


A single Temp Table handle is passed back for each item in the DataPA configuration except for the Subjects where two temp tables are passed back. One is for the Subject itself and the other is for the Subject’s fields.


Once you have written both the procedures and they are placed in the PROPATH of the AppServer you want to use you must ensure that the database that you have defined you new tables in, is connected to the AppServer you are using.


As with any AppServer based configuration by default the Security will disallow access to the DataPA Setup and DataPA Security screens. In order to allow access you need code a new hook procedure on the AppServer which allows you to control, for each user, what functionality they have access to in DataPA.


This hook procedure is described in more details in this "How do I configure the security settings of a DataPA client from the server, based on the user's username?"  but an example of it which allows access to the Security and Setup screens for all users is noted below:


 /*------------------------------------------------------------------------
    File        : PAGetSecData.p
    Purpose     : Retrieve Security Data From Server

    Syntax      : Run PAGetSecData.p (INTPUT <UserName>,
                                      INPUT-OUTPUT TABLE ttSecData)
                                 
    Description : Contains a hook to allow administrator to decide client
                  security level and apply license codes from server. The
                  cUsername parameter is populated with the username the
                  user logged in with or their windows username. The ttSecData
                  temp-table will be populated with a single record with the
                  default value for each security field. To change the security
                  behaviour of the client, simply change the value of the
                  relevant field. For numeric values, the value returned sets
                  the following behaviour:
                 
                  0 - Prevent user access
                  1 - Allow user access
                  2 - Determine user access from the default on the client

    Author(s)   : Nick Finch
    Created     : 01/11/05
    Notes       :
 
  Copyright © 2005 by DataPA Limited and other contributors as listed below.
  All Rights Reserved.
  ------------------------------------------------------------------------
                            Amendments
                            ==========
 
  Date      Author          Description
  ========  ==============  ==============================================
  ------------------------------------------------------------------------ */

DEFINE TEMP-TABLE ttSecData
  FIELD AllowLinks AS INTEGER INITIAL 2                  /* Can user change links */
  FIELD AllowSecurity AS INTEGER INITIAL 2               /* Can user access security screen */
  FIELD AllowSetup AS INTEGER INITIAL 2                  /* Can user access setup screen */
  FIELD AllowSubject AS INTEGER INITIAL 2                /* Can user change subjects */
  FIELD AllowSystem AS INTEGER INITIAL 2                 /* Can user change systems */
  FIELD RequireSetupPassword AS INTEGER INITIAL 2        
                                       /* Does user require password to enter security screen */
  FIELD SetupPassword AS CHARACTER INITIAL ""            
                                       /* Password required to enter security screen */
  FIELD UserLevel AS CHARACTER INITIAL ""                
           /* Set to change userlevel (set to RunOnly to prevent creating reports & queries) */
  FIELD RegUser AS CHARACTER INITIAL ""                  
                              /* To apply licence dynamically, set to name of registered user */
  FIELD RegOrganisation AS CHARACTER INITIAL ""          
                      /* To apply licence dynamically, set to name of registered organisation */
  FIELD RegSerialNum AS CHARACTER INITIAL ""            
                                        /* To apply licence dynamically, set to serial number */
  FIELD RegCode AS CHARACTER INITIAL ""                  
         /* To apply licence dynamically, set to registration code (without spaces or dashes) */
  FIELD RegCrystalCode AS CHARACTER INITIAL ""          
                         /* To apply crystal licence dynamically, set to Crystal license code */
  /* The following field is only valid for VERSION 3.00.0064 and above. Remove if you are using an earlier version*/
  FIELD AllowSetupLockOverride AS LOGICAL INITIAL FALSE.
                                    /* To allow user to override setup lock, set this to true */.  

 
DEFINE INPUT  PARAMETER ip-cUserName     AS CHARACTER  NO-UNDO.
DEFINE INPUT-OUTPUT PARAMETER TABLE FOR ttSecData.

FIND FIRST ttSecData.

ASSIGN ttSecData.AllowLinks    = 1
       ttsecdata.AllowSetup    = 1
       ttsecdata.AllowSubject  = 1
       ttsecdata.AllowSystem   = 1
       ttsecdata.AllowSecurity = 1.


Now you are ready to change the data location setting in DataPA to store and read the configuration information from the database. It is easy to switch from you current data location setting to the new one and by doing so the configuration information will be stored in the database for you using the procedure you just coded.


In the Security screen in DataPA select the Data Location tab. In the Data Location field enter the URL of the AppServer that you want to use. Then change the Data File Format to be DB.


You screen should look something like this:


Then click OK. When you first change the data location to store the the DataPA configuration in the database you will be asked whether you want to write you current DataPA setup configuration to the database or read what is in the database to be you DataPA configuration. As there is nothing in the database tables at present you want to choose Yes here and the database tables will get populated with your current setup configuration.

If you receive any errors doing this you can check for more details in the AppServer log files.

You can now check the database tables to see if they have the new records expected.

If you now close down DataPA and reopen it the configuration should be read from the database.