Global variables contain information about the client mobile device. For example, there is one variable to indicate the device's type, another to indicate its dimensions, and yet another to indicate the device's current orientation (landscape or portrait), and so on. The values of all these variables are obtained at run-time from the client device as part of standard mobile communication procedures. Variables can then be used in XPath/XQuery expressions. As a result, processing can be specified that is conditional upon a device's inherent static properties (such as size) or its changeable dynamic properties (such as orientation).
MobileTogether Designer has a standard library of global variables, which is displayed in the Global Variables dialog (Project | Global Variables, screenshot below). In this dialog, you can also define custom variables for use throughout the project. The values of customized user variables are set with XPath expressions.
The Global Variables dialog (screenshot above) displays three types of variables:
•Static-value variables: These variables contain values that do not change during the execution of the project. Notice that the header of the Value column indicates the mobile device that has been selected in the Device Selector combo box. The values of variables vary with the client device. For example, the variable \$MT_Android has a value of true() when the mobile device being used is an Android.
•Dynamic-value variables: These variables contain device-related and project-related values that can change during execution. For example, the \$MT_ControlNode variable has different values according to which node is the current node at a given time during project execution.
•User variables: In addition to the standard library of global variables, you can add your own global variables (called User Variables in the dialog) in the lower pane of the dialog. You use XPath expressions to give a user variable a value.
|When defining a user variable, do not use a \$ symbol in the name of the variable. When you use any global variable in an XPath expression, however, you must, as usual, use the \$ symbol. For example:
concat('http://www.', \$company, '.com')