10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How You Can Create a User ClassYou thus define the Hire, GetCurrent, and GetHistory methods, and theattributes they use, only once: for abstract class HourlyEmployee. TheTempEmployee and ContractEmployee classes inherit these methods fromHourlyEmployee.How Invoking User Class Methods in 4GL WorksUser classes are functionally equivalent to system classes, that is, anyoperation you can perform with a system class in the 4GL code of anexecutable component can be done with a user class. However, although the4GL syntax for invoking a method on a user class object is identical to that of asystem class, you often handle user classes differently from system classes.For example, the following code invokes the Hire method on a temporaryemployee:tempemp.Hire(LastName = 'Goodman', FirstName ='Robert',HireDate = 'today', EmpNum = 1292,TerminationDate = '2/28/94',CurrentClass =14, CurrentPay = 5.00);In all likelihood, however, most values for the Hire method are input atruntime by the user typing into form fields. The form fields are children of acomposite field that is mapped to the TempEmployee user class. Becausethese values are automatically available to any method invoked on thatcomposite field, you may not need to pass method parametersprogrammatically as shown in the code example.How You Can Create a User ClassYou create a user class, define its attributes, and optionally declare and defineits methods and superclass in the Class Editor of the OpenROAD Workbench.For instructions to create a user class, see the User <strong>Guide</strong>.When you define attributes, you specify:• The name by which they are referenced• A data type• A default value (optional)• Nullability• A remark describing the attribute• Whether the attribute is private to the classWorking with Classes 127

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

Saved successfully!

Ooh no, something went wrong!