10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

VariablesWhen you create a field on a form, you specify the variable's name and datatype on the field's property inspector in the OpenROAD Workbench. Unless youspecify otherwise, OpenROAD automatically declares the variable that you useto access the data in that field. If the field is a named composite field, such asa stackfield or subform, the variable is a reference variable and you may ormay not define its data type (class).If you do define the data type for the reference variable, the data type mustbe a system or user class name. You can choose to exclude fields for some ofthe attributes (this provides a way to keep additional undisplayed controlinformation).If you do not name the class when you create a composite field, OpenROADcreates an unnamed class that you can reference only within the frame thatcontains the composite field.How You Can Reference Reference VariablesIn OpenROAD, you can work with an object as a whole or with the attributes ofthe object. To manipulate the object as a single unit, use the name of theobject's reference variable in your 4GL code.For example, you can create a subform and specify its variable's class as anamed user class. In your program you could then pass the values in thesubform fields to a procedure simply by naming the variable as a procedureparameter.In the following statement, customer is the name of the variable associatedwith a subform:callproc update_cust (new = customer)To access an individual attribute that belongs to an object, use the dotnotation:referencevariable_name.attribute_nameFor example, assume that the subform previously described contained a fieldcalled address. To reference that field, you would use:customer.addressIn the following example, city and street are attributes of class addr, andaddress is a declared reference variable:address.city = 'Dallas';x = address.street;callframe delete_old (address = address.city);Language Elements 29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!