Salesforce

Automatic Non-Procedural Recomputing of Init Expressions (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

Automatic Non-Procedural Recomputing of Init Expressions (Magic xpa 4.x)

Regardless of the mode of operation of the task, Magic xpa automatically recomputes and reassigns Init expressions just as in a spreadsheet, when any of the variables participating in the expressions change during the execution of the Record level. Magic xpa does the recomputation and reassignment according to the following rules:

Init expressions are recomputed if any of their component variables have been modified and the modified variable has been declared prior to the declaration of the variable with the expression. The recomputing mechanism in the Data View Editor works forward only.

Any changes to variables in the Record Suffix will cause recomputation of all the Data View Init expressions that these variables participate in. The scope of recomputation is from the modified variable's selection position in the data view until the end of the data view.

The recomputation of initialized variables is one of several non-procedural processes of Magic xpa's engine.

In the following explanation, a variable that includes a non-zero Init expression number is called an Initialized variable. Any variable that is a component of the Init expression, and whose modification causes the recomputation of the Initialized variable, is called a modifying variable.

Consider the following example. Suppose that Variable A has value 5 and Variable B has value 6. If Variable C's Variable operation specifies as its Init expression A*B, then while the end user runs the task in Create Mode, Variable C will be initialized to the value 30. However, if the end user later changes the value of Variable A to 7, the Init expression for Variable C will be automatically (non-procedurally) recomputed to 42 without the insertion point moving to Variable C.

A change to a modifying variable can be caused by:

  • User input, as in the example above

  • An Update Var operation

  • Its usage as a property of subtask or program

  • Data imported by a Form Input operation

  • Its usage as a Return Code variable

A change to a modifying variable may occur either in the Data View (interactive) phase and any subtask called from the Record level, or in the non-interactive Record Suffix phase.

Recomputation is carried out for any variable with an Init expression that contains variables:

  • In both Create and Modify modes of operation

  • In both Online and Batch tasks

  • In both Fast mode and Step mode

Recomputation proceeds repeatedly for all recomputed initialized variables, because a recomputed variable in its turn might be a modifying variable for other Init expressions. One cycle of recomputation may cause another, until all Init expressions are satisfied.

To be recomputed, the initialized variable must meet both of the following conditions:

  • The initialized variable's must be positioned in the Data View Editor after the modifying variable.

  • The initialized variable's Init expression contains the modifying variable.

Variable Change Logic Units

The Variable Change logic unit is raised whenever a variable is updated.

Sometimes, when a variable is updated, this update also affects other variables due to recompute (for example: if the variable is used in the init expression of another variable).

The following section describes the execution sequence once the value of a variable is changed:

  1. The Variable Change handler is executed.

  2. If this change also affects other variables (for example due to the init expression), then all the variables that are affected by this change are added to a queue. The last variable defined in the data view is the first variable added to the queue, and so on.

Exceptions: For Rich Client non-Offline programs, the Variable Change logic unit is not invoked if the variable is updated in the Task Prefix.

Once the engine finishes this process, the engine is ready to handle the variables in the queue. The engine will fetch a variable from the queue and carry out the process on it.

The order that the variables are fetched is in the opposite order that they were added. In other words, the last one that was added is the first one that is fetched. This is known as LIFO (Last In First Out).

Reference
Attachment 
Attachment