You use EAL (Extended Action Language) to change model data and run multi-step logic in MDriven actions; it is for developers who already use OCL expressions and need those expressions to perform work.
What EAL is
EAL extends OCL with operations that change data. Use it when an expression must assign a value, create or delete an object, change a collection, or run several statements in sequence.
For example, OCL can calculate a value. EAL can store that value:
self.SomeInt := 27EAL uses the same expression syntax as OCL where possible. The important difference is that EAL can have side effects: it changes the object model or the state used by an action.
Where you can use EAL
Use EAL in the execution expression or implementation that needs to perform an action.
| Location | What EAL does there | Example use |
|---|---|---|
| Action execute expression | Performs the work when the action runs. | Set a date and update a status value. |
| ViewModel column Execute expression | Performs work from an action defined in a ViewModel column. | Store a user-entered value on the current object. |
| Class method implementation | Defines the behavior of a model operation. | Update attributes when an operation is called. |
| State machine effect | Performs work when a state-machine transition occurs. | Record a value as an object changes state. |
When you place actions in a web-client table, action type affects whether the action is available. See Documentation:Web client actions in tables for the behavior of class actions, ViewModel/context actions, and ViewModel actions that contain EAL.
Write an EAL action
1. Start with an OCL expression
Navigate from the current object with self and evaluate values as you would in OCL. For example, this reads the current date and time:
DateTime.Now2. Assign with :=
Use := to assign a new value. Use = to compare values; it does not assign.
self.SomeInt := 27The following action assigns the current time, then formats that stored value as text:
self.SomeDateTime := DateTime.Now;
self.SomeInt := 27;
self.SomeString := self.SomeDateTime.ToString('yyyy-MM-dd')3. Separate statements with ;
A semicolon separates statements in a multi-step EAL action. The action result is the value of its last statement.
Put semicolons between statements, not after the final statement. A trailing semicolon makes the parser expect another statement and results in an unknown type.
| Expression | Result |
|---|---|
'a string'; 0
|
Valid; the expression has integer type because 0 is the final statement.
|
'a string'; 0;
|
Invalid; the trailing semicolon requires a following statement. |
4. Create objects when the action needs new model data
EAL can create objects with Create. For example, create a new Thing object with:
Thing.CreateEAL also supports deleting objects and changing collections with Add, Remove, and Clear operations. Keep object creation, collection changes, and subsequent assignments together in the action that owns the business operation so the sequence is explicit.
Calling an inherited implementation
When you override a class method and need the inherited implementation to run too, call it through self.base. This follows the same pattern as calling a base implementation in C#.
For example, an overriding OnCreate implementation can call the implementation on its superclass before adding its own behavior:
self.base.OnCreateSee Documentation:Calling base class for the complete inherited OnCreate example.
Use EAL with ViewModels
A ViewModel action can contain EAL without being linked to a separate action. Use this for behavior that belongs to the ViewModel, such as handling a value entered in the current screen context.
For example, an action-column execution expression can assign the current time to the object shown in its row:
self.SomeDateTime := DateTime.NowKeep the expression focused on the action the user invoked. For table-specific availability and supported action types, see Documentation:Web client actions in tables.
Use EAL for transformations and integration
EAL can process values before they are stored. One use is reverse derivation: code processes a composite value into its separate parts when the composite value is updated. See Documentation:Reverse Derivation for that pattern.
EAL can also run HTTP operations. For a concrete REST POST pattern, including response variables and a ViewModel nesting used to format an upload request, see Documentation:OCLOperators RestPost.
Common rules and gotchas
- Use
:=for assignment and=for comparison. - Use
;only between statements. Do not end the final statement with a semicolon. - Start a multi-step action with changes that establish the values later statements need. In the date example,
SomeDateTimeis assigned before it is formatted. - Use
self.base.OperationNamewhen an override must retain the superclass implementation. - Treat EAL as action logic. Use OCL when you only need to calculate, navigate, or constrain without changing data.
