OnEdit.LST script file

<< Click to Display Table of Contents >>

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

OnEdit.LST script file

Description

It is executed every time the input form is opened for viewing, for editing or when saving a new document.

Activation

Options→Data Input

Input

any field name


@EDIT

1: the record exists in the DB and an EDIT operation is in progress

@INSERT

1: the record does not exist in the DB and an INSERT NEW RECORD operation is in progress

@UNIQUE_ID

uid ( only when @EDIT=1 )

@CURRENT_PROJECT

the name of the current project (highlighted by the red arrow in the TreeProject)

currentProject In this example ProjectZ is the current project

@SELECTED_PROJECT

the name of the currently selected project in the Data Input Form

SelectedProject

@PARENT_WINDOW_TITLE

the title of the window the script has been called from

@PARENT_WINDOW_HANDLE

the handle (long integer) of the window the script has been called from

@CURRENT_DATAENTR_TXT_FILENAME

it allows the script developer to understand what is the current FORM definition file that invoked the script. For example, the developer can open such form definition file and look for what field names are listed into it.

@REVISION_PHASE

this variable is passed if not null only;
values can be "REVISION_PROCESSED" | "REVISION_APPROVED" | "REVISION_NEW" | "REVISION_ACTIVATED" | "CHECKIN"

Remarks

stateCOUTstateCIN @REVISION_PHASE=CHECKIN

stateNEWstateCIN @REVISION_PHASE=REVISION_NEW

stateRELstateCIN @REVISION_PHASE=REVISION_NEW

Output

@OKDATA

1: automatic confirmation for the standard input form (such as clicking OK button);
0: the edit is cancelled (such as clicking Cancel button)



Example

.VBSCRIPT

Sub main()
 DBWInit(TRUE)
 inEdit = DBWInput("@EDIT")
 inInsert = DBWInput("@INSERT")
 Descr = DBWInput("DESCRIPTION")
 Notes = DBWInput("NOTES")
 'DBWMsgBox "edit=" & inEdit & vbcrlf & "insert=" & inInsert
 if inEdit = 1 then
  DBWOutput "DESCRIPTION",Descr & "- added by ONEDIT.LST",ForWriting
  DBWOutput "NOTES",Notes & "- added by ONEDIT.LST",ForAppending
 end if
 if inInsert = 1 then
  DBWOutput "DESCRIPTION","New description created by ONEDIT.LST",ForWriting
  DBWOutput "NOTES","New note created by ONEDIT.LST",ForAppending
 end if
End Sub