Variables (Magic xpa 3.x)
Variables, sometimes referred to as fields in other programming languages, are the building blocks of the data view. In general, they store information that is needed by the task.
Magic xpa uses different types of variables:
Column – Column variables are the columns of a data source. Column variables can be selected from the Main Source or from a linked table. You can determine the display and behavior of columns by using the Column Properties.
Virtual – Virtual variables are temporary (local) variables that only exist for the duration of the task. They are used for computation and temporary storage. You can determine the display and behavior of local variables by using the Local Variable Properties.
Parameter – Parameter variables are local variables used to pass data in and out of a task or program. You can determine the display and behavior of local variables by using the Local Variable Properties. Parameters are passed according to the order they appear in the data view. Magic xpa does not make a distinction as to where the parameters are placed within the data view. It is possible to disperse parameters throughout the data view. However, for both readability and maintenance, it is better to group these variables together. Parameters are normally defined at the beginning of the data view.
Column and Virtual variables, and passing Parameters together constitute the task’s logical record. The set of logical records selected from the Main Source and linked tables in accordance with the task’s range rules constitutes the task’s data view.
Each variable is assigned a letter code. Whenever you want to refer to a variable in a task, you use this letter code, which represents the variable's position in the program hierarchy where:
A is the first selected variable
B is the second selected variable
BA is the 27th selected variable and so on.
If in an expression a variable is required and not the value it represents, the VAR literal should be used to indicate to Magic xpa the proper use of the variable identifier. If the variable was relocated, Magic xpa will automatically update all of the references to the variable with the new letter code.
The variables in the Variable selection list are colored according to their type.
Studio and Runtime Behavior