REPLACE()

From Recital Documentation Wiki
Revision as of 16:37, 20 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

REPLACE()

Class

Fields and Records


Purpose

Function to replace fields in the current record buffer without re-reading the current record


Syntax

REPLACE(<field>,<exp>)


See Also

SET POSTRECORD, SET PRERECORD, CREATE, MODIFY STRUCTURE, REPLACE, @...GET


Description

The REPLACE() function allows fields in the current record buffer to be modified without re-reading the record. The REPLACE function will update the <field> with the value stored in <exp>. The <exp> must be the same data type as the <field> being replaced. When used in conjunction with the PRERECORD, POSTRECORD and table UPDATE trigger procedures, REPLACE() can be used to add timestamps, and other "hidden" information to records which are processed through forms. If any dictionary validation or security is in effect for the specified <field>, then this will be checked. If the field cannot be updated, .F. is returned, otherwise .T. is returned. The REPLACE() function is particularly useful when used in POSTRECORD trigger procedures which are activated in APPEND forms. The REPLACE() function replaces data in the active record buffer, these changes are not written to disk until action is taken to commit the record. The REPLACE command is unlike the REPLACE() function, in that changes to the active record buffer are written to disk immediately.


Example

procedure postrec
replace(time, time())
replace(use, getenv("username"))
replace(date, date())
return .T.
 
use accounts
set postrecord to postrec
append


Products

Recital Mirage Server, Recital Terminal Developer