OCLOperators OnUpdate
No edit summary
(Automatically adding template at the end of the page.)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
OnUpdate is called just before the onbject is saved to database. Here you can do things needed on every save operation.
OnUpdate is called just before the object is saved to the database. You can do things needed on every save operation here.


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


You can't create new objects from within then OnUpdate action. That will leave the newly created object unsaved.
For example, in the method body for OnUpdate, set this OCL:
 
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   
  if self.existing then -- This avoids touching the object if it has been deleted   
   self.ChangeTime:=DateTime.Now;  
   self.ChangeTime:=DateTime.Now;  
Line 14: Line 12:
See more: [[Acting on object changes]], [[OCLOperators IsDirty|IsDirty]]
See more: [[Acting on object changes]], [[OCLOperators IsDirty|IsDirty]]


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

Latest revision as of 15:39, 10 February 2024

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 

See more: Acting on object changes, IsDirty

See also: OnCreate, OnDelete, OnStateChange

This page was edited 88 days ago on 02/10/2024. What links here