Open Road Programming

Elements Variables:

    Varibles is associated with an application(Global variable) or with specific procedure frame, procedure, method, field script, or events blocks(Local Variable).

There 3 Types of Variables:

Simple varibale:(All Simple variables are nullable)

    It is a single data item.

    name = datatype : for integer varible empid = Integer not null default 101;

Reference Varible:

In OpenROAD, you can work with an object as a whole or with the attributes of

the object. Here uc_employee_class is an user defined class.

 

employeeObj = uc_employee_class ;

 

you can access the class attributes like employeeObj.name, employeeObj.street.

Dynamic Array Variable

To declare an array variable, specify any system class or user class for the objects associated with the variable.

The syntax is: name = array of class [with] default null]

The following code is an example:

Emparray = array of Emp;

When you declare an array, it is empty. OpenROAD does not populate the array automatically. There are a variety of

methods that you can use to add rows to an array.

Field and Menu Varibles

Field and menu item variables are variables that are associated with the value in a field or menu item. These variables are not associated with the object represented by the field or menu item.

It is not necessary to declare field and menu item variables in your scripts; OpenROAD declares them automatically when you create the field or menu item in the Application Workbench. To reference the object represented by a field or menu item instead of its value, use the field function, as described in The Field Function section, with the field or menu item variable. For example, the following statement changes the background color of the previously described entry field:

Field (title).bgcolor = CC_ORANGE;

Intializing Varibales

When OpenROAD starts an application, any global variables associated with the application are initialized. Similarly, when you call a frame or procedure, OpenROAD initializes the variables associated with the frame or procedure.

OpenROAD also uses the system default for variables declared in the initialize statement of a frame script. For simple variables, the system defaults are

 

zero for numeric data types and

empty string (’’) for non-nullable character data types.

 

i = integer not null default 3;

For reference variables, OpenROAD creates an object of the declared class and sets the reference variable to reference that object. The attributes of this object are initialized to their default values (which are specified in the class definition). For attributes that are reference variables, you can set the initial value of the variable to null. In this case, no

object is created for the reference variable.

 

DataTypes

 

Language Elements- Expressions:

Expressions are language constructs that resolve to a value, a set of values, or TRUE or FALSE. Expressions can contain a wide variety of language elements. For example, you can use:

In addition, OpenROAD allows you to use all the operators and functions of the Ingress DBMS. Expressions are used widely in 4GL.

 

Literals

There are two basic types of literals: string and numeric. OpenROAD also supports hexadecimal constants and the null constant.

 

String Literals

String literals are represented by a sequence of characters enclosed in single

quotation marks, for example:

’J. J. Jones’

’Hendersonville’

’17-Aug-1988 10:00’

 

Numeric Literals

 

Numeric literals include integers and floating-point numbers, for example:

1209

7.77

Do not enclose numeric literals in quotes. You can specify literals of type money either as strings ( ’$10.50’) or numbers (10.5).

 

Hexadecimal Constants

 

Hexadecimal constants are a special version of string literals. Hexadecimal constants are single-quoted strings of hexadecimal digits (0-9 and A-F) preceded by the letter X, for example:

    X’10A665B’

    X’00FF’

 

The Null Constant

The null constant is represented by the special keyword null. You use this keyword to assign a null to a nullable variable or database column. For example, the following statement assigns a null to the variable amount:

    Amount = null;

For more information about nulls, refer to the Nulls section.

Named Constants

A named constant is a literal value to which you give a name. You can then use the name in place of the constant in any 4GL expression.

if salary > HISALARYVALUE then ...

 

Language Elements -System Varibles:

System Variables

System variables are built-in variables that are available in all frames and

scripts. OpenROAD provides the following system variables:

CurEventScope: The context of the currently executing event block. A local variable of type Scope. Referencing CurEventScope outside of an event block causes a compile-time error.

CurScriptScope: The context of the currently executing field script. A local variable of type Scope. Referencing CurScriptScope outside of a field script causes a compile-time error.

CurFrame:The current frame. A local variable of type FrameExec. Refer to online help for more information about using the CurFrame variable.

CurMethod:The currently executing user class method. A local variable of type  MethodExec.

CurObject:The user class objects on which the currently executing user class method was invoked. A local variable of type UserObject.

CurProcedure:  The currently executing procedure. A local variable of type ProcExec.

 

CurSession: For each application, a global variable of type SessionObject that contains information about the current runtime environment, such as whether the user’s display supports color or what operating system is being used.

IIDBMSerror :  The error code returned as a DBMS-specific error number. This error code reflects the last SQL statement encountered for the current frame or procedure’s current DBMS connection. If no error occurred, IIDBMSerror is set to 0. For the associated generic error number, refer to the IIerrornumber system variable

IIerrornumber:  The error code returned as a DBMS-independent error number. This error number reflects the last SQL statement encountered for the current frame or procedure’s current DBMS connection. If no error occurred, IIerrornumber is set to 0. For the associated DBMS-specific error code, refer to the IIDBMSerror system variable

 

IIrowcount:  The number of rows affected by the last SQL statement encountered for the current frame or procedure’s current DBMS connection. After select statements, IIrowcount is the number of rows selected. After insert statements, it is the number of rows inserted into the database. After delete or update statements, it is the number of rows affected.

 

Operators:

OpenROAD supports these operators:

Arithmetic operators (+,-,*,/,**)

The String operator(+ join)

Logical operators(AND, OR,NOT)

Comparison (boolean) operators (TRUE,FALSE, =,!=, <>, <,>,>=, <=, is null, is not null)

The Like operator (like , not like)

The Is Null operator

The following sections describe these operators.