Derived settable associations
No edit summary |
(Automatically adding template at the end of the page.) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Derived attributes & associations]] are read-only, but you can also have writable associations that update other attributes or links when they themselves are set. Read here about how that works on attributes: [[Derived settable attributes]]. | [[Training:Derived attributes & associations|Derived attributes & associations]] are read-only, but you can also have writable associations that update other attributes or links when they themselves are set. | ||
Read here about how that works on attributes: [[Derived settable attributes]]. | |||
[[File:Derived settable class example.png|none|thumb|531x531px]] | [[File:Derived settable class example.png|none|thumb|531x531px]] | ||
OCL for reading Class2selection | OCL for reading Class2selection: | ||
self.Class2 | self.Class2 | ||
EAL for the writing Class2Selection | EAL for the writing Class2Selection: | ||
self.Class2 := vInputParameter; | self.Class2 := vInputParameter; | ||
self.SelectionLog := self.SelectionLog + DateTime.Now.asString + ': '+ vInputParameter.Name + '\r\n' | self.SelectionLog := self.SelectionLog + DateTime.Now.asString + ': '+ vInputParameter.Name + '\r\n' | ||
Line 11: | Line 13: | ||
Here is the sample model to be loaded into the designer: [[:File:DerivedSettableExample.modlr]] | Here is the sample model to be loaded into the designer: [[:File:DerivedSettableExample.modlr]] | ||
[[Category:Associations]] | [[Category:Associations]] | ||
{{Edited|July|12|2024}} |
Latest revision as of 15:33, 10 February 2024
Derived attributes & associations are read-only, but you can also have writable associations that update other attributes or links when they themselves are set.
Read here about how that works on attributes: Derived settable attributes.
OCL for reading Class2selection:
self.Class2
EAL for the writing Class2Selection:
self.Class2 := vInputParameter; self.SelectionLog := self.SelectionLog + DateTime.Now.asString + ': '+ vInputParameter.Name + '\r\n'
The most common use case for this is to execute "extra" code for recalculating other persisted values based on the new value of a change to a link.
Here is the sample model to be loaded into the designer: File:DerivedSettableExample.modlr
This page was edited more than 11 months ago on 02/10/2024. What links here