19. Using 4GL : Expressions : Using Fields and Variables as Expressions
 
Share this page                  
Using Fields and Variables as Expressions
Each field or variable in a form can be used in an expression or as an expression in itself. In this example, the "age" field appears alone on the left side and is an element in the expression "age + 1" on the right of the assignment statement:
age := age + 1;
The current value is used in the computation of a new value that increments and replaces the current value.
In the same way, you can use a column or hidden column in an expression or as an expression in itself:
total := 0;
unloadtable emptable
begin
    total := total + emptable.salary
end
In this example, the "salary" column from the "emptable" table field is added to the "total" field as part of an unloadtable loop.