How Init Works (Magic xpa 3.x)
Init assigns values according to two scenarios: procedural and non-procedural.
In the procedural method, the same rules apply for Virtual and Parameter variables, while different rules apply for Column variables:
Column variables of the Main source are initialized only when an Online task runs in Create mode of operation. In this case, Magic xpa evaluates the Init expression and assigns its value to the variable before the record is displayed on the screen. For Batch tasks, the initialization will not be executed.
Column variables within a Link Create will be initialized by the Init expression if the link fails. This rule applies for both Online and Batch tasks.
Virtual variables are always created on-the-fly. Therefore, Magic xpa evaluates the Init expression and assigns its value to a Virtual variable in all modes of operation and before the record is displayed on the screen.
Parameter variables are created and behave like Virtual variables. A Virtual variable without an Init expression receives its value through the Update operation. Such a variable retains its previous value. Magic xpa adopts this approach for Virtual variables without an Init expression to support the use of Virtual variables as a counter or a sum variable, since the Virtual variable keeps its value from the previous execution.
Automatic Non-Procedural Recomputing of Init Expressions