Variables
Variable Naming & Lookup
Naming rules
Variable reference have the form ${Varname}. Variable names are case sensitive and may contain any valid character except a closing brace '}'.

Search Algorithm
When a variable reference is encountered, each object starting at the present object, its parent, its parent, and so on is asked if it can provide a definition for that variable. The first definition encountered is used. If no object can provide a definition, the global variable list is then searched in order. If more than one global variable is defined with the same name, the results are undefined.

Variable Errors The following conditions will trigger an error, and the variable reference will return the string ERROR.

  • Unterminated variable name. Opening '${' not matched by closing '}'.

  • Maximum variable name length (31 characters) exceeded.

  • Too many variable replacements - typically when a variable recursion loop exists. The limit is 32.

  • No expansion found for variable name.

Variable Lookup Recursion Two types of variable recursion are permitted; this is one.

If a variable expansion results in a string that contains another variable reference, variable expansion happens again on the new string until either no variable references are left, or a maximum replacement count is exceeded.

For example, consider a Screenswitch class with a Screen Name that references a global variable ${MyScreen}. The Screenswitch contains a text object that references the variable ${ScreenName} (defined by Screenswitch).

First, the text object expands ${ScreenName}, which results in the string ${MyScreen}. Then, ${MyScreen} is expanded to yield the value defined in the main variable list (or perhaps a parent object such as a template object).

Variable Name Recursion Two types of variable recursion are permitted; this is another.

Recursion is permitted on variable names. Consider three variables, var1=Foo, var2=Bar, and variable FooBarXYZ=test.

The reference ${${var1}${var2}XYZ} will yield the string test. Inner variables are expanded before outer.

Read-Only Global Variables Some global variables are read-only. In many cases their value will change between expansions; for example, the amount of free memory.

Date & Time Variables (uses Locale settings)

Variable Explanation Example
AmPm AM/PM string AM
DayNum Day number (leading zeros) 03
DayNumSp Day number (leading spaces) 3
Hour12 Hour in 12 hour format (leading zeros) 04
Hour12Sp Hour in 12 hour format (leading spaces) 4
Hour24 Hour in 24 hour format (leading zeros) 04
Hour24Sp Hour in 24 hour format (leading spaces) 4
Min Minute value 59
Month Month name April
MonthNum Month number 05
MonthShort Month name (short) Apr
Sec Seconds 33
Weekday Day of week Tuesday
WeekdayShort Day of week (short) Tue
Year2 2 digit year 97
Year4 4 digit year 1997

Memory & Resource Variables

Variable Explanation Example
ChipKb Chip memory in Kb 1910
FastKb Fast memory in Kb 31022
AllKb All memory in Kb 32932
LargestKb Largest block in Kb 28107
ChipMb Chip memory in Mb 1
FastMb Fast memory in Mb 31
AllMb All memory in Mb 32
LargestMb Largest block in Mb 28