Function to replace fields in the current record buffer without re-reading the current record
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.
procedure postrec replace(time, time()) replace(use, getenv("username")) replace(date, date()) return .T. use accounts set postrecord to postrec append