| Syntax Color Legend |
|---|
| Command |
| Mandatory parameter |
| Optional parameter |
| Mandatory keyword |
| Optional keyword |
{PRIVATE|PUBLIC} ROUTINE <Class>.<Routine> [(<Parameterlist>)][ : <Resulttype>]
[CONST
<Definitions>]
[VAR
<Definitions>]
[BOOLEANS
<Definitions>]
BEGIN_ROUTINE
<Code lines>
END_ROUTINE
Defines a class routine that can be defined in forms, reports, global performable routines, locally defined classes, and global class definitions.
Depends on the <Result type> definition.
| Parameter | Description | |
|---|---|---|
| PRIVATE | PUBLIC | The access modifier of the class routine. Private class routines can be accessed only from inside a public class routine of the same class. Public class routines defined in a global class can be accessed from any routine in a form, report, or global performable routine. Public class routines from a locally defined class can be accessed from any routine in the object where the class is defined. Although an access modifier keyword is not mandatory and the default is private, we recommend that you always specify it for clarity. | |
| <Class>.<Routine> | Name of the class routine. | |
| <Parameterlist> | List of declarations. Unless they are constant declarations, the parameters (fields) specified in this list can be invoked directly through a class routine call. Each specified parameter must have a type and length. If multiple variables have the same type and length, you can declare them together. You can also specify the options VAR or CONST, which are comparable to the specifications for definitions inside the routine. The syntax for declaring the parameters is: [VAR | CONST] <Field specification> [:] <Type> <Length> [OPTIONAL] |
|
| VAR | Declares that the specified fields are variables to be called by reference. When using this option, the following rules apply:
|
|
| CONST | Declares that the specified fields are constants. When using this option, fields are treated as read-only and therefore cannot be changed through the calling routine. | |
| <No type definition> | When no type definition is provided, the parameter is available as a variable inside the procedure, but changes to its value affect only the local variable. | |
| <Field specification> | Specification of one or more field names. When you declare multiple fields at once, use a comma (,) as the separator so the fields are defined with the same characteristics. It is possible to use DCT in variable declarations in the routine header, for example: |
|
| <Type> | The type of the variable or variables, which may be ALPHA, NUMERIC, BOOLEAN, STRING, INTEGER, SIGNED, FINANCIAL, PRINTER (for text reports), or PRINTERGRAPHICAL (for graphical reports). | |
| <Length> | The maximum length of the specified variable or variables. This parameter is required only if the type is ALPHA or NUMERIC. The number of decimals is supplied after a dot. | |
| OPTIONAL | When specified, this parameter can be omitted in the routine call. This can be used only for the last consecutive parameters in the parameter list. | |
| <Resulttype> | Type returned after the routine ends. You can also use DCT.
|
|
| CONST | Declares that the next <Definitions> section defines constants that can be used only locally inside the routine. |
|
| BOOLEANS | Declares that the next <Definitions> section defines a Boolean function that can be used only locally inside the routine. |
|
| VAR | Declares that the next <Definitions> section defines variables that can be used only locally inside the routine. |
|
| <Definitions> | Definitions for constants or variables used in the program. To call multiple variables at once locally, you can define variables within a structure. | |
| <Code lines> | Code lines that are executed within the routine. Only class members of the same class, global items, and system items are accessible inside a class routine. Other locally defined items, such as variables, routines, and screen objects, are outside the scope of a class routine. | |
Parameters for the routine are defined in the <Parameter list>. Optionally, you can specify a <Result type>. The value of the resulting variable is then returned as the return value. After the routine definition header, the definitions of the constants (CONST section) are specified, followed by the variable definitions (VAR section). The instructions that must be executed when the routine is called are specified between the keywords BEGIN_ROUTINE and END_ROUTINE.
Inside class routines, it is only possible to access other class members (both class variables and class routines) of the same class, global items (global variables and global routines), and system items. Variables, routines, and screen items defined in a form or report cannot be accessed inside a class routine because they are outside the scope of a class routine.
public routine Local_Class.setColour (colour_code : dct dct_colour_code)
begin_routine
this.carColour := colour_code
this.carClrDate := today.yymmdd
this.emailUpdates()
end_routine