Event References
How to refer to the value of another event in mathematical models
There are moments when building a mathematical model in SEL that you need to pull the value of another event into a SEL expression. This is called an event reference, and looks similar to a worksheet reference in a spreadsheet, e.g. !'Worksheet1':A3
.
Note: references to other event values is often done in Strings & Text when writing liquid syntax, like so: =String({{ other_event }})
.
Liquid syntax references are exception to the first thing you should ask yourself when using event references in a mathematical model:
Are you sure?
Event references make code harder to read and should be used sparingly. Often, they are "necessary" because the model has been composed in such a way that event values cannot flow naturally. That said, if you're in a bind, they're there.
Okay, you read the safety warning. On to the syntax.
Formulas
We use event titles to refer to events from elsewhere. For example, if we have an event called "Other Expenses", all of the following are valid:
=!'Other Expenses'
=!'Other Expenses' + 10k
+ !'Other Expenses'
Notice the exclamation point and title wrapped by single tick marks: '
.
Generators & Containers
You can also use event references as the initial values for the construction of a generator or container:
=Source(!'Developer Salary')
=Funnel(!'Initial Deposit', !'Spending Rate')
Unlike formulas, these values will only be used for the initialization of the event. Once the event is initialized, these references dissolve and the values of the event will no longer depend on the value of the referenced events.
Use Unique Event Titles
Since event references rely on titles, you will run into issues if you give multiple events the same title. Make your event titles unique! If you're using the Summit IDE, this will be enforced automatically.
Updated 7 months ago