Altova MobileTogether Designer

The action (screenshot below) updates the value of an existing user-defined variable that you identify by selecting it in the action ($area in the screenshot below). The new value to update with will be one of the following:

 

the result of evaluating an XPath expression that you enter

an Action Group result

a subpage result

MTActionUpdateVariable

The variable to be updated can be any user-defined variable that is in scope at the point when the Update Variable action is triggered. These variables include: user-defined global variables; variables defined in the Let and Try/Catch Exceptions actions; variables in Action Groups; the parameters of a sub page; and the parameters and variables of control templates. (Note that the Update Variable action cannot be applied to Loop variables.)

 

Double-click the field (circled green), and either enter the name of your user-defined variable or select it from the list that appears.

 

At run time, if no variable with the given name is found, then an error message to this effect is generated together with a list of variables that are in scope at that point and which could potentially be updated.

 

Note:Application-defined variables (such as Dynamic Local Variables and Static Global Variables) cannot be modified by the Update Variable action.

 

The XPath option

The XPath option enables you to enter a static value or to generate a dynamic value using XML tree nodes. For example, in the screenshot below, the values of two nodes are multiplied (circled in red). The resulting value will be passed to the user-defined variable $area.

MTActionUpdateVariableXP

 

The Action Group Result option

The Action Group Result option (screenshot below) sets the value of the variable to be the result of an Action Group. In the screenshot below, we have given the variable a name of $area, and set its value to be the result of the Action Group called RectangleArea (circled in red below). (All existing Action Groups are available for selection in the variable's combo box.) To edit the Action Group, click the Edit button (circled in green). We have also defined the values of two parameters to be dynamic; they will take their values from XML tree nodes.

MTActionUpdateVariableAGR

The Action Group returns a result via the Return action (see screenshot below). In the screenshot below, for example, we declare two parameters ($length and $width); in the Return action, we multiply the values of the two parameters. Note that the values of the parameters are obtained at runtime from the XML tree nodes that have been defined, in the Let action (see screenshot above), as the values of the Let action's parameters.

MTDVarsAGresult01

 

The Subpage Result option

The Subpage Result option (screenshot below) sets the value of the variable to be the result of a subpage. This allows a calculation to be carried out on another page. When a subpage is closed, it can optionally return a result. This result is the Subpage Result that will be used as the value of the variable defined in the Update Variable action. For example, in the screenshot below, the Update Variable action defines a variable called $area and sets its value to be the result of the subpage called RectangleArea.

 

The properties of the Subpage Result option are the same as the Go to Subpage action, and are described in detail there.

MTActionUpdateVariableSR

At runtime, when the Let action is executed, the subpage is opened and it will be processed as defined in its design. The subpage will be closed when the Close Subpage action is executed. This action has an optional return value which is calculated by an XPath expression (see screenshot below). This returned value will be passed to the Let action and will become the value of the variable defined in the Let action.

MTDCloseSubpage

 

MobileTogether extension functions

MobileTogether provides a range of XPath extension functions that have been specifically created for use in MobileTogether designs. Some functions can be particularly useful with specific actions. For example, mt-available-languages() returns the languages in which the solution is available and could, for example, be used with the Message Box action. If a function is especially relevant to this action, it is listed below. For a full list of extension functions and their descriptions, see the topic MobileTogether Extension Functions.

 

© 2018-2024 Altova GmbH