2. Language Elements : Variables : Reference Variables : How You Can Declare Reference Variables
 
Share this page                  
How You Can Declare Reference Variables
To declare a reference variable, use the following syntax:
name = class [ [with] default null]
The value of class can be any named user class or system class (for a complete list of system classes, see the Language Reference Guide online help). The following example declares a reference variable of the StringObject class:
strobj = StringObject;
All reference variables are nullable.
When you create a field on a form, you specify the variable's name and data type on the field's property inspector in the OpenROAD Workbench. Unless you specify otherwise, OpenROAD automatically declares the variable that you use to access the data in that field. If the field is a named composite field, such as a stackfield or subform, the variable is a reference variable and you may or may not define its data type (class).
If you do define the data type for the reference variable, the data type must be a system or user class name. You can choose to exclude fields for some of the attributes (this provides a way to keep additional undisplayed control information).
If you do not name the class when you create a composite field, OpenROAD creates an unnamed class that you can reference only within the frame that contains the composite field.