Variables

Lists the variables created in this macro. Variables are global to all screens in this macro and in any chained macros.

You can assign an arithmetic expression to a variable as the initial value, for example, 2 + 3 + 'a' = '5a' or (5 + 3) * 8 = 64. Arithmetic operations can be performed on numbers, integer variables, double variables, field variables, and string variables. When your operands are non-numeric, for example, strings and booleans, you can only use the plus sign (for string concatenation). Z and I Emulator for Web macros support the following operations:

Symbol Operation
+ Add
- Subtract
* Multiply
/ Divide
% Mod
Variables
Lists the variables created in the macro. To create a new variable click <new variable>.
Remove
Click Remove to remove the selected variable from the list.
Name
The variable name. A variable name should have the following format: $ var_name$, where var_name can be alphanumerics, the dash symbol, and the underscore symbol. Variable names must be enclosed in dollar signs. Variable names are case sensitive.
Type
Select the variable type. The type may be standard or imported.
  • Standard variable types
    • The standard variable types are: string, integer, double, boolean, and field.
    • The field variable type allows you to store the text at a specific row and column on the screen into a variable. If you select field, the Initial Value field is disabled.
  • Imported variable types
    • If you have defined any imported types then the short name that you specified for each imported type will be listed in the Type list. If you did not specify a short name then the fully qualified class name will be listed.
Import
Click Import to pop up the Import dialog. The fields on the Import dialog are described below:
Imported Types
Lists the imported types created in the macro. To create a new imported type click <new imported type>.
An imported variable type is based on an underlying Java class implemented in an external JAR or CAB file.
Remove
Click Remove to remove the imported type from the list.
Class
The fully qualified class name of the class on which the imported type is based, including the package name if any. Class names can contain only the following characters: alphanumerics, underscore (_), hyphen (-), and period (.). Case is significant. Z and I Emulator for Web does not check to see whether the class exists until the macro is run. At that time the class must be found somewhere in the classpath.
Short Name
An optional short name that you can use anywhere in the macro to refer to the imported type. If you do not specify a short name here then you must use the fully qualified class name each time you refer to the imported type in the macro.
Initial Value
Specify the initial value for this variable. The initial value must match the type.
Variables are created in the macro in the order in which they are listed. If the initial value you specify for the current variable is an expression containing other variables, those other variables must appear in the list before the current variable.
  • Standard variables types The following table lists the valid initial values for variables of standard type. The initial value can be a value returned by a method belonging to a imported type. In the examples below, $varImport$ is a variable belonging to an imported type.
    Variable type Valid initial values Examples
    boolean Boolean values (true or false) true false $varImport.isEmpty()$
    integer Integer number (positive, negative, or 0) 5 -3 $varImport.size()$
    string A text string. These can be a combination of boolean, integer, double, string, field variables, and actual text strings '123 Main Street' 'item ' + 56 'hello13' + 5 $varImport.toString()$
    double Double-precision number 4.2 1.0e4 -4.8e-3 $varImport.meters()$
  • Imported variable types You can assign the following kinds of items to a variable belonging to an imported type:
    • null Note: To express this value use the keyword null. An empty string ("") also signifies the value null. An uninitialized variable belonging to an imported type is treated as if it had a value of null.
    • Another variable belonging to the same imported type. Example: $varImport2$
    • A return value belonging to the same imported type returned by a constructor or method. Example: $new MyClass( 'Application', 1505, true )$
    • An expression that resolves to any of the above items.

Related topics