OnCheckout.LST script file

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Event Scripts > Revision >

OnCheckout.LST script file

Description

It is executed when checking out a document. Using this script it is possible to control the way a document is checked out, basing on rules that can be implemented in the script itself.

Activation

Options→Revisions

Input

@DOCUMENT_UNIQUE_ID

uid of the doc to checkout

Output

@OKCHECKOUT

0: fail; 1: ok to proceede

See also

OnUnCheckout.LST script file
OnCheckoutRecord.LST script file

Example

Suppose we want to avoid the checkout of documents whose ID begins with 'Pa'; the script could be written in the following way:

.VBSCRIPT
Sub Main()
 DBWInit(true)
 uid = DBWInput("@DOCUMENT_UNIQUE_ID")
 if uid = 0 then
  DBWMsgBox "Error: document unique id is 0!"
  DBWOutput "@OKCHECKOUT","0",ForWriting
  exit sub
 end if
 id = DBWQueryByUid( uid, DBWLookUp("NAME_FIELD_ID") )
 if left(id,2)="Pa" then
  DBWOutput "@OKCHECKOUT","0",ForWriting
 else
  DBWOutput "@OKCHECKOUT","1",ForWriting
 end if
end sub