20. Writing 4GL Statements : Forms-Control Statements : Clearing a Screen or Form
 
Share this page                  
Clearing a Screen or Form
To erase one or more fields on the currently displayed form, or to blank the entire screen, use these statements:
clear field fieldname [, fieldname ] 
clear field all
clear screen
Clear field initializes fields to blank, zero, or null values depending on the nullability of each field. It does not operate directly on derived fields. A derived field is cleared indirectly, however, when one of its source fields is cleared. This example clears the Name and Age fields on the current form:
clear field name, age;
Note:  Mode update restores previous field values, even if the fields have been cleared. To avoid restoring previous values, use set forms form (mode = update).
Clear field all clears all displayed fields on a form. This does not include any local or global variables.
Clear field all;
Clear screen blanks the entire screen without clearing values from fields for the duration of the operation in which it is used. It then redraws the screen and redisplays the data. The following example clears the screen in preparation for displaying a prompt to the user:
initialize =
begin
        clear screen; 
        answer = prompt 'Enter the correct code';
end
For more information about the clear statement, see clear Statement--Clears the Screen or Fields.