|
<< Click to Display Table of Contents >> Navigation: Advanced Features > Integrated Workflow Module > The Default Workflow Model |
A Default Workflow Model is available as demo when installing DBWorks.
This Default Workflow Model manages a revision scheme made of Major Revisions and Minor Revisions.
It also creates an eDrawing for each document submitted to the workflow. This eDrawing is the document on which to exchange red-linings and annotations to the documents along the approval process.
The working logic can be explained with the following sample.
Suppose to have a document P1 in state RELEASED with a revision value A.
Now, we consider major revisions values like A, B, C, … and minor revisions values like A.1, A.2, A.3, … The OnNewRev.LST script is programmed so as to generate only minor revisions.
The designer increments the revision state of P1, so putting the document in CHECKED_IN state, with revision value A.1.
The designer can, at this point, start to work on P1, checking-out and checking-in as usual.
He wants now to approve this intermediate minor revision, and he will do, so having the P1 be in state RELEASED with value A.1.
No workflow actions have been involved until this time: the user has worked on P1 as always, no worring about the presence of the DBWorkFlow module.
Now, after some discussions and preliminary tests on P1/A.1, he decides to create a new version of P1, named A.2.
He increments the revision state of P1, so putting the document in CHECKED_IN state, with revision value A.2.
The designer can again, at this point, start to work on P1, checking-out and checking-in as usual.
When finished, with the P1 in CHECKED_IN state, he wants now to ask the team management to approve this part, assigning it a major revision value, suppose B.
He then can RMB on the part P1, choosing the Workflow function Submit to Workflow for the approval.
This function will launch, as said above, the subroutine ECA() of the script LST\SYSTEM\workflow.vbs, where the logic of asking the major revision value and launching the DBWorkFlow process is contained.
At this point, all the activities on the document P1 are locked, until the DBWorkFlow system gives back the control to the designer, notifying him about the approval or the rejecting of his request.
If approved, the document P1 is finally ready to be phisically approved in DBWorks by the designer.
If rejected, the designer can still continue to work on P1, checking-out and checking-in until ready, so to re-submit the request of approval to the team management.
If the current user has no permissions on taking decisions on the current Workflow state, DBWorks shows now a RMB menu that can be clicked, showing a dialog with the list of the users allowed to take decisions on the current state. If the DBWORKS_USERS table has the additional varchar fields PHONE and EMAIL ( you can add them using the SQL Server Enterprise Manager ), and if these fields contains the actual phone number and e-mail addresses of the users, they will be displayed in the list, allowing the current user to call or advise the interested users to to advance in the Workflow states.
Must be programmed so to handle the logic of the assignment of the ECO_ID to the document being submitted to the Workflow Module.
The script has the following input/output parameters:
Input:
@DOCUMENT_UNIQUE_IDS |
"<uid1> <uid2> <uid3> …" |
A string containing the list of the unique ids of all the documents being submitted to the Workflow Module; the unique ids are separated by blank spaces.
Output:
@OK |
0/1 |
0=failed; 1=success
@ECO_ID |
<ECO identifier> |
A string containing the ECO identifier ( may be a number or an alphanumeric string )
Optional outputs:
@EVENT_LOG_NOTES |
A note to be associated in the workflow event log to this event
@EVENT_LOG_FILE_UID |
|---|
@EVENT_LOG_FILE_ATTACHMENT |
Pairs of outputs, with the UID always preceding the ATTACHMENT, for assigning files as attachment to the workflow event log records for this submission action; the standard sample provided in this document implements the creation of eDrawings when the submission is executed
Example:
.VBSCRIPT
'
' OnSubmitToWorkflow.vbs
'
' Workflow Integrated Module main script
'
' Author: C.Ettorre
'
const dbwarm_workflow_eca = 50
const eDrawingsRoot = "W:\eDrawings\"
sub main()
DBWInit(TRUE)
okwkfl = DBWGetOption("OK_WORKFLOW_MODE")
okEnhanced = DBWGetOption("OK_ENHANCED_WORKFLOW")
docUids = DBWInput("@DOCUMENT_UNIQUE_IDS")
ok = false
if okwkfl = 1 and okEnhanced = 0 then
if DBWIsDeniedFeature(dbwarm_workflow_eca) then
DBWMsgBox "Permission denied!" & vbcrlf & "You dont have the rights to submit a request of approval."
exit sub
end if
ok = true
end if
if ok = false then
DBWMsgBox "ECA submittal not allowed." & vbcrlf & "Make sure that the Workflow mode be enabled"
exit sub
end if
radio_active = 0
res = DBWRadioCombo ( "ECO ID Assignment", "Choose the ECO ID modality:", "Create a new ECO ID", _
"Attach to an existing ECO ID",1, _
"", "", false, _
radio_active, combo_value)
'DBWMsgBox "radio active=" & radio_active
if res = false then
DBWOutput "@OK","0",ForWriting
exit sub
end if
'
' calculate the next major revision
'
tokens = Split( docUids," " )
'DBWMsgBox "tokens(0)=" & tokens(0) & vbcrlf & "ubound=" & ubound(tokens) & vbcrlf & "docUids=" & docUids
currentRevision = DBWQueryByUid( tokens(0), DBWLookUp("NAME_FIELD_REVISION") )
majorRev = NextMajorRevision( currentRevision )
majorRev = InputBox("Confirm the major revision value:","Submit for approval",majorRev )
if majorRev = "" then
DBWOutput "@OK","0",ForWriting
exit sub
end if
if radio_active = 1 then
ecoIdDescr = InputBox("Assign a description for the ECO:","ECO Assignment")
if ecoIdDescr = "" then
DBWOutput "@OK","0",ForWriting
exit sub
end if
'
' generate the current ECO_ID
'
eco_id = getEcoId(ecoIdDescr)
else
eco_id = DBWFilterSelect(_
"Select an existing ECO ID",_
DBWorksConnectionDSN,_
"SELECT ECO_ID, ECO_DESCRIPTION FROM DBW_WORKFLOW_ECO",_
"ECO_ID",_
"ECO_DESCRIPTION",_
multiresult _
)
end if
if eco_id = "" then
DBWOutput "@OK","0",ForWriting
exit sub
else
if DBWMsgBox2("The document will be assigned to the ECO_ID: " & eco_id & vbcrlf & "Confirm ?", 4, "ECO ID Assignment") = 7 then
DBWOutput "@OK","0",ForWriting
exit sub
end if
end if
firstUid = tokens(0)
'
' pass the first of the unique ids
'
DBWShell("RenameCurrentRevision " & replace(majorRev," ","|") & " " & firstUid & " " & eco_id )
DBWOutput "@OK","1",ForWriting
DBWOutput "@ECO_ID",eco_id,ForAppending
DBWOutput "@EVENT_LOG_NOTES",ecoIdDescr,ForAppending
'
' create initial eDrawing2 files in the eDrawingsRoot
'
for i=0 to ubound(tokens)
eDrawingID = eco_id + "_" + tokens(i)
DBWShell("PrintInfo " & replace("DBWorkFlow is creating the eDrawing " & eDrawingID," ","|") )
ok = DBWCreateEDrawingAs( tokens(i), eDrawingsRoot, eDrawingID, eDrawingFullPathName )
DBWOutput "@EVENT_LOG_FILE_UID",tokens(i),ForAppending
DBWOutput "@EVENT_LOG_FILE_ATTACHMENT",eDrawingFullPathName,ForAppending
next
DBWShell("ShowBrowser")
DBWShell("PrintInfo " & replace("Done!"," ","|") )
DBWMsgBox "The request of approval has been successfully submitted with ECO_ID=" & eco_id
end sub
function getEcoId( description )
getEcoId = 0
Dim connection
Set connection = CreateObject("ADODB.Connection")
connection.Open DBWorksConnectionDSN, DBWorksConnectionUID, DBWorksConnectionPWD
connection.Execute("INSERT INTO DBW_WORKFLOW_ECO (ECO_DESCRIPTION) VALUES ('" & description & "')" )
Dim recordSet
Set recordSet = CreateObject("ADODB.Recordset")
query = "SELECT @@IDENTITY"
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
function NextMajorRevision(inputString)
tokens = Split( inputString, ".",2,1)
iValue = CInt(tokens(0))
iValue = iValue+1
NextMajorRevision = CStr(iValue)
end function
Must be programmed so to generate only minor revisions identifiers. For the description of this script, consult the On-Line Help System of DBWorks. We want to remember here that through this script it is also possible to automatically fill any other field value of the revision record to be created.
Example:
A typical example of this script, able to generate subrevisions sequences like A.1, A.2, …, B.1, B.2, … is the following:
.VBSCRIPT
Sub Main()
DBWinit(TRUE)
lastRevision = DBWInput("@LAST_REVISION")
modeless = DBWInput("@MODELESS")
lastRevision = NextSubRevision(lastRevision) 'it should be always calculated through a function
iin = lastRevision
if modeless=0 then
iin = InputBox("Please enter the new sub-revision value in the format A.1:", "Assign a new revision", lastRevision )
if iin<>"" then
DBWOutput "REVISION", iin, ForWriting
end if
else
DBWOutput "REVISION", iin, ForWriting
end if
End Sub
function NextSubRevision(inputString)
NextSubRevision = inputString
tokens = Split( inputString, ".", 2, 1)
if ubound( tokens ) = 1 then
NextSubRevision = tokens(0) & "." & (cint(tokens(1))+1)
Else
If inputString = "" then
NextSubRevision = "0.1"
else
NextSubRevision = inputString & ".1"
End if
end if
end function
Must be programmed so to check if a revision is to be considered major or minor.
The script has the following input/output parameters:
Input:
@REVISION |
a string containing the revision of the document being processed |
|---|---|
@UNIQUE_ID |
the unique id of the document being processed |
Output:
@OKMAJORREV |
0/1 |
0=is a minor revision; 1=is a major revision
Example:
The following script considers major revisions the ones composed only of alphabetic characters, without numbers or points.
.VBSCRIPT
sub main()
DBWInit(TRUE)
revision = DBWInput("@REVISION")
uniqueId = DBWInput("@UNIQUE_ID")
result = MyLogicForCheckingMajorRevisions( revision )
DBWOutput "@OKMAJORREV", result, ForWriting
end sub
function MyLogicForCheckingMajorRevisions( inputString )
MyLogicForCheckingMajorRevisions = 0
if inputString <"A" or inputString> "ZZZZZZZZZZZZZZZ" then
MyLogicForCheckingMajorRevisions = 0
exit function
end if
if left(inputString,1) = "." then
inputString = "0" & inputString
end if
tokens = Split( inputString, ".", 2, 1)
if ubound( tokens ) = 1 then
l = Len( tokens(1) )
if l>0 then
MyLogicForCheckingMajorRevisions = 0
else
MyLogicForCheckingMajorRevisions = 1
end if
else
MyLogicForCheckingMajorRevisions = 1
end if
end function