The Update method updates the current record last read into the instance. This method has the precondition that a record is currently loaded in the instance. On success, the database record is updated.
Update fails if:
A record is not currently loaded into the instance (this can occur because the instance hasn't yet participated in a database read operation or because of an Initialize or Clear call). Glb.Status is set to "*****" and logic execution continues.
There is a duplicate key. The keys of the currently loaded record are changed such that a record with the same keys already exists in the database.
Maint is anything other than "C" or "D".
If an instance, with a database record loaded, is assigned to a second instance, the second instance is not attached to the database record, and therefore you cannot use the Update method with the second instance. If you attempt to use the Update method with the second instance you can get unpredictable results on different platforms, such as Windows and MCP. To use the Update method with the second instance, you must explicitly re-read the record into the second instance before using the Update method.
Syntax
<<persistent class>>::Update(void) : void
Owner
Any persistent class.
Example
The logic in the following example is incorrect because the instance “AnotherCUST” is not attached to the record that was previously read into the instance “CUST”, and therefore the Update method does not succeed:
Lookup “1” CUST AnotherCUST := CUST AnotherCUST.Attr5 := 123 AnotherCUST.Update()
The logic can be corrected by calling the Load() method to explicitly re-read the record into the instance “AnotherCUST”:
Lookup “1” CUST AnotherCUST := CUST AnotherCUST.Load() AnotherCUST.Attr5 := 123 AnotherCUST.Update()