SET POSTRECORD
Contents
SET POSTRECORD
Class
Screen Forms
Purpose
Designate an event-driven trigger to execute as a record in a form file is exited
Syntax
SET POSTRECORD TO [<procedure-name> | (<expC>)]
See Also
SET PREFORM, SET POSTFORM, SET PRERECORD, @...GET, CREATE SCREEN, MODIFY SCREEN
Description
The POSTRECORD trigger procedure executes a procedure whenever a record is updated from within the format file. The SET POSTRECORD TOTO <procedure-name> command defines the procedure or program name to be executed. The filename can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename. The commands in the POSTRECORD trigger procedure are executed before the record is updated and unlocked. Conditional parsing of the data entered may be performed at this time and the resulting condition returned. If .F. is returned, the update is not performed and the user is placed back into the form. Only when .T. is returned from the POSTRECORD trigger is the record updated.
The [EXIT/SAVE] and [PAGE DOWN] keys will call the POSTRECORD trigger from EDIT, CHANGE, INSERT and APPEND. The [PAGE UP], [FIND] and [MENUBAR] keys will call it from EDIT, CHANGE and INSERT. POSTRECORD triggers are table specific, and will execute when records in the same table are updated. A form that contains records from different tables may employ POSTRECORD triggers from each represented table. Table fields, for example, may activate a different POSTRECORD trigger for each parent child relationship. The SET POSTRECORD trigger can also be defined from within the SCREEN PAINTER work surface. The POSTRECORD procedure option from the TRIGGERS menu is used to define the trigger name. The [HELP] key may be pressed here to edit the trigger file from inside the SCREEN PAINTER.
If the POSTRECORD trigger is a <.prg filename> instead of a <procedure-name>, the format file can be used both interactively and from the Recital Information Center without needing any procedures to be predefined. The SET POSTRECORD TO command clears the active <procedure-name>. The REPLACE command cannot be used in a POSTRECORD trigger procedure to update records in the current view. The REPLACE() function is used for this purpose.
Example
procedure timestamp replace(timefield, time()) return .T. select 1 use payroll alias payroll set form to formname select 2 use audit_file alias audit_file select payroll set postrecord to timestamp edit
Products
Recital Mirage Server, Recital Terminal Developer