PreInsert(trigger insert action pre-processing)

Top  Previous  Next


PreInsert(OpCode, AddLength ErrCode, ErrMsg ), returncode


Returns confirmation that valid dictionary trigger activity has occurred before an insert action, and optionally sets an error code and message to be processed.


A SIGNED integer that indicates the type of ADD that will be attempted.


An UNSIGNED integer that indicates the record length about to be added when the ADD ( File, Length) mode is active.


A string constant, variable, EQUATE, or expression that represents an error code.


A string constant, variable, EQUATE, or expression that represents an error message.


Indicates if an error occurs.

The PreInsert method is a virtual method that returns a TRUE value by default if pre-insert trigger activity was processed normally. The developer must set the return level to FALSE if any problems occurred in the pre-insert trigger activity code. When PreInsert returns FALSE, an ERRORCODE 100 (trigger error) is posted. If ErrCode is set, then FILEERRORCODE will be set to the contents of ErrCode when the error is processed by the ErrorClass object for the associated file (table). Similarly, FILEERROR will be set to ErrMsg.

The OpCode and AddLength parameters can be used in your pre-processing trigger code.









Use the Equates provided in EQUATES.CLW (shown above) to test the OpCode. AddLength is used to return the value of the length parameter if used with ADD.

The PreInsert method is accessible from a table’s trigger properties located in the Dictionary Editor, or, in the Global Embeds of a target application


PreInsert is implemented using the file driver callback mechanism, therefore, this method will have access to all variables that the File Manager has access to. These variables and the ones added in the Data section of the method will allow the developer to insert code that will be executed before an INSERT action for a file.

Return Data Type:     BYTE




 ReturnValue = PARENT.PreInsert(OpCode,AddLen,ErrCode,ErrMsg)

  MESSAGE('Trigger Test Before Insert')

  !Trigger code entered here


 RETURN ReturnValue

See Also:     PostInsert , PreDelete , PreUpdate