Implement workflow on a replicated environment

<< Click to Display Table of Contents >>

Navigation:  Advanced Features > Integrated Workflow Module >

Implement workflow on a replicated environment

How to implement workflow in a replicated environment

The workflow in a replicated environment requires the following adjustments:

1.The identity columns (ECO_ID and EVENTID) of the tables DBW_WORKFLOW_ECO and DBW_WORKFLOW_EVENT_LOG need to be configured as "not for replication".
Furthermore the identity seed of those columns must be set to separate value for each database which is part of the replication.
The procedure for this is similar to the one for the DOCUMENT table, see Manual setup procedure for enabling the DBWorks database to be replicated (Step 1: Change the UNIQUE_ID field definition).

2.The way in which a new ECO ID is generated must be changed within the OnSubmitToWorkflow.lst. The generation of new ECO ID must be implemented in dependency to the facility. In case of the customer I add a field ECO_COMPANY_ID to the DBW_WORKFLOW_ECO table and change the GetEcoId function as follows:

function getEcoId( description )

    getEcoId = 0
    companyId = DBWGetOption("COMPANY_ID")
    Dim connection
    Set connection = CreateObject("ADODB.Connection")
    connection.Open DBWorksConnectionDSN, DBWorksConnectionUID, DBWorksConnectionPWD
    connection.Execute("INSERT INTO DBW_WORKFLOW_ECO (ECO_DESCRIPTION, ECO_COMPANY_ID) VALUES ('" & description & "', '" & companyId & "')" )
    Dim recordSet
    Set recordSet = CreateObject("ADODB.Recordset")
    'use the following query for SqlServer
    'query = "SELECT @@IDENTITY"
    query = "SELECT MAX(ECO_ID) FROM DBW_WORKFLOW_ECO WHERE ECO_COMPANY_ID = '" & companyId & "'"
 'use the following query for MDB
    'query = "SELECT ECO_ID FROM DBW_WORKFLOW_ECO ORDER BY ECO_ID "
    recordSet.Open query, connection ,3
    While recordSet.EOF=FALSE
        getEcoId = recordSet.Fields(0).Value
        recordSet.MoveNext
    wend
    recordSet.close
    Set recordSet = Nothing
    connection.Close
    Set connection = Nothing
end function