Kbase P104784: ASSIGN statement fails to update data
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  27/05/2005 |
|
Status: Unverified
SYMPTOM(s):
Application opens dialog-style window allowing users to update data
Update button trigger uses an ASSIGN statement to update record
Window closes after the ASSIGN statement but data has not been updated
Accessing record in Main Block using FIND ... EXCLUSIVE-LOCK
AUTO-END-KEY property is set for the Update button
Setting FIND statement in the Main Block to NO-LOCK results in error 396 when attempting the ASSIGN statement
** <filename> record has NO-LOCK status, update to field not allowed. (396)
Setting FIND statement in the Main Block to SHARE-LOCK results in the data being updated as expected
Encapsulating the FIND statement (and relevant subsequent statements) in DO TRANSACTION block results in the data being updated as expected
CAUSE:
The AUTO-END-KEY property causes an ENDKEY condition to be raised and the transaction scope extends from the Main Block to the Update trigger. The Main Block is defined with the following settings:
ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
When clicking the Update button, an ENDKEY condition is raised so whilst the ASSIGN statement does complete and does update records, when the code returns to the Main Block, the transaction (and therefore the changes made in the ASSIGN statement) gets undone.
FIX:
Option #1
Use the AUTO-GO property for the Update button.
Option #2
In the Main Block, use FIND ... NO-LOCK. In the Update trigger, use FIND ... EXCLUSIVE-LOCK on the record before performing the ASSIGN.