|
|
|
|
|
- Declaring the constants
- Limits: Declaring a constant member
- Limits: Declaring constants with the same name
Constant In french: Constante
The constants are language elements whose value is fixed once and for all. This value cannot be modified during the execution of the program.
CONSTANT
VATRate = 20
END
Syntax
Declaring one or more constants Hide the details
CONSTANT <Name of Constant 1> = <Value 1> <Name of Constant 2> = <Value 2> END
<CONSTANT>: Marks the beginning of the declaration of constants. <Name of Constant>: Name of constant to declare. <Value>: Value of the constant. <END>: Marks the end of the declaration of constants. Remarks The constants must be declared in: - The project initialization code in order to be used in all the processes of the project (codes of project, codes of windows, codes of controls, procedures, ...).
- The declaration code of global variables of a window in order to be used in all the processes of the window (code of window, codes of controls found in the window, local procedures, ...).
- The opening code of a report in order to be used in all the processes of the report (codes of report, code of controls found in the report, local procedures, ...).
- The declaration code of a class in order to be used in the class.
- To access this constant from a method of the class, use the syntax "::<Constant name>".
- To access this constant from a code external to the class, use the following syntax "<Class name>::<Constant name>".
Remark: A constant is always global: - to a project,
- to a window,
- to a page,
- to a report,
- to a class.
Limits: Declaring a constant member A constant member cannot be declared in: - a structure,
- a composite variable.
Limits: Declaring constants with the same name - Several elements (variables or constants) with the same name cannot be declared in the same process.
- If a constant and a variable have the same name in the same project:
- the variable will be used in the process where it was declared and in all the linked processes.
For example, the variable is declared in the click code of a button. When clicking this button, this variable is passed as parameter to a local procedure. This variable will be used in this local procedure. - the constant will be used in all the other processes.
- If a constant "global" to the project and a constant "global" to a window have the same name:
- the constant "global" to the window will be used in all the processes of the window and window controls as well as in the "local" procedures of the window.
- the constant "global" to the project will be used in all the other processes.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|