Function DbUpdate() Foundation
Updates the current work area with data from another work area.
DbUpdate( <cAlias>, ;
<bReplace>, ;
<bIndexKey>, ;
[<lRandom>] ) --> NIL
The return value of DbUpdate() is always NIL.
The function DbUpdate() updates records in a work area with values from the records of a second work area <cAlias>. An update occurs only when the code block <bIndexKey> provides the same value in both work areas. This assumes that the controlling index with the index key <bIndexKey> is active in the first work area and that no duplicate key values exist there. The records of the source work area are sequentially processed, using the return value of <bIndexKey> on each source record as the argument to DbSeek() in the target work area. If a matching record is found, the code block <bReplace> is evaluated. Within this code block, values from the fields in the source work area should be used to update the target work area.
If the value .T. (true) is specified for <lRandom>, the data records of the source work area can be in any order. Otherwise, the source work area must also be sorted or indexed by the index key <bIndexKey>.
If records in one of the two work areas are marked as deleted, they are ignored by DbUpdate() when SET DELETED is turned ON. If SET DELETED is OFF, all records are taken into consideration and their "deleted" status remains unchanged.
If the function DbUpdate() is used in multi-user (network) operation, the file in the target work area must be locked with FLock() or must be exclusively opened. The file in the source work area does not need to be locked, since only read access occurs.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.