Difference between revisions of "SET POSTRECORD"

From Recital Documentation Wiki
Jump to: navigation, search
(Example)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=SET POSTRECORD=
 
 
 
==Class==
 
Screen Forms
 
 
 
 
==Purpose==
 
==Purpose==
 
Designate an event-driven trigger to execute as a record in a form file is exited
 
Designate an event-driven trigger to execute as a record in a form file is exited
Line 15: Line 8:
  
 
==See Also==
 
==See Also==
[[@...GET]], [[CREATE SCREEN]], [[MODIFY SCREEN]], [[SET POSTFORM]], [[SET PREFORM]], [[SET PRERECORD]]  
+
[[@...GET]], [[APPEND]], [[CHANGE]], [[CREATE SCREEN]], [[EDIT]], [[FMT()]], [[Function Keys]], [[INSERT]], [[MODIFY SCREEN]], [[QUERY]], [[REPLACE]], [[REPLACE()]], [[SET POSTFORM]], [[SET PREFORM]], [[SET PRERECORD]]  
  
  
 
==Description==
 
==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 POSTRECORD trigger procedure executes a procedure whenever a record is updated from within the format file.  The SET POSTRECORD TO <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.   
 
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.   
Line 29: Line 22:
 
<code lang="recital">
 
<code lang="recital">
 
procedure timestamp
 
procedure timestamp
    replace(timefield, time())
+
  replace(timefield, time())
 
return .T.
 
return .T.
  
Line 39: Line 32:
 
select payroll
 
select payroll
 
set postrecord to timestamp
 
set postrecord to timestamp
edit</code>
+
edit
 +
</code>
 +
 
  
 
==Products==
 
==Products==
Recital Mirage Server, Recital Terminal Developer
+
Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[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]]

Latest revision as of 15:33, 21 December 2012

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 TO <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