Difference between revisions of "SET POSTRECORD"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 26: | Line 26: | ||
<code lang="recital"> | <code lang="recital"> | ||
procedure timestamp | procedure timestamp | ||
− | + | replace(timefield, time()) | |
− | replace(timefield, time()) | + | |
− | + | ||
return .T. | return .T. | ||
Line 47: | Line 45: | ||
[[Category:Commands]] | [[Category:Commands]] | ||
[[Category:Set_Commands|POSTRECORD]] | [[Category:Set_Commands|POSTRECORD]] | ||
+ | [[Category:Screen Forms]] | ||
+ | [[Category:Screen Forms Set Commands]] | ||
+ | [[Category:Triggers]] | ||
+ | [[Category:Triggers Set Commands]] |
Revision as of 10:33, 3 June 2009
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
@...GET, APPEND, CHANGE, CREATE SCREEN, EDIT, FMT(), Function Keys, INSERT, MODIFY SCREEN, QUERY, REPLACE, REPLACE(), SET POSTFORM, SET PREFORM, SET PRERECORD
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