Update

Takes two parameters, TableName, IfLenFld

Usage:

TableName, IfLenFld
TableName, [""]
[WorkWith], [""]
TableName, [WorkIf]
[WorkWith], [WorkIf]

Description:

The command updates each Record in the Database for each Record in the Work Query. There must be one Field in the Work Query named TableName.Alias; such as if updating Records in the MemTab.Person table, there must be a MemTab.Person.Alias Field in the Work Query.

The value of the .Alias Field in the WorkQuery must match the Alias of the Record in the Database Table to be updated. If the value of the .Alias Field in the WorkQuery is blank it will be skipped without error.

If there are any other Fields in the Work Query that start with the Table Name, where the name matches that of the Database Tables’ Fields, then that Field’s data will be use to update the Record in the Database. By default, any Fields that exist in the Table but do not exist in the Work Query will be updated to be blank. If the Database state of BackFill is True for the current Thread, then any missing Fields, or Fields with a value of *, will retain the data currently in the Database.

If an error occurs during the execution of this command on one or more Records, the error message will be placed into a Field in the Work Query named Error. The Field named Error will be created automatically if needed and it does not already exist.

Example:

Rem 'Update the competition's name
WorkWith "Comp.Competition"

            SetNew  "Alias", `CompetitionAlias
            SetNew  "Name", `CompetitionName

Backfill
             Update
End Backfill
            FailIfRecError
End WorkWith
EndRem