OCLOperators OnUpdate
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 11: Line 11:
   false  
   false  
  endif  
  endif  
See more: [[Documentation:Acting on object changes|Acting on object changes]], [[OCLOperators IsDirty|IsDirty]]
'''Learn more:''' [[Documentation:Acting on object changes|Acting on object changes]], [[Documentation:OCLOperators IsDirty|IsDirty]]


See also: [[OCLOperators OnCreate|OnCreate]], [[OCLOperators OnDelete|OnDelete]], [[OnStateChange]]
'''See also:''' [[Documentation:OCLOperators OnCreate|OnCreate]], [[Documentation:OCLOperators OnDelete|OnDelete]], [[Documentation:OnStateChange|OnStateChange]]
[[Category:OCL General Operators]]
[[Category:OCL General Operators]]
{{Edited|July|12|2024}}
{{Edited|July|12|2025}}

Latest revision as of 05:39, 5 February 2025

This page was created by Lars.olofsson@mdriven.net on 2019-11-18. Last edited by Stephanie@mdriven.net on 2025-02-05.

OnUpdate is called just before the object is saved to the database. You can do things needed on every save operation here.

Please note! You can't create new objects from within the OnUpdate action - that will leave the newly created object unsaved.

For example, in the method body for OnUpdate, set this OCL:

if self.existing then -- This avoids touching the object if it has been deleted  
  self.ChangeTime:=DateTime.Now; 
  false 
else  
  false 
endif 

Learn more: Acting on object changes, IsDirty

See also: OnCreate, OnDelete, OnStateChange