19. Using 4GL : Assigning Values to Fields and Variables : Assigning Nulls to Nullable Variables
 
Share this page                  
Assigning Nulls to Nullable Variables
4GL provides the following three ways to assign a null value to a nullable variable:
Direct assignment
To assign a null to a simple field or a local or global variable, use the format:
field := null;
To assign a null to an attribute of a record, use the format:
recordname.attributename := null;
To assign a null to a table-field item, use the format:
tablefieldname[row].columnname := null;
From the database
If you select a column from the database that contains a Null value, the receiving 4GL variable contains NULL. The variable must be of a nullable type.
From a system function
If a system function does not return a valid value, the receiving variable is set to NULL. For more information about system functions, see System Functions in Using Procedures as Expressions.
Through the FRS
A field is assigned a Null value in the following cases:
If you tab through a nullable field or nullable table-field column without making an entry.
If you press Return without entering a value in response to the prompt statement (and the receiving variable is nullable).