Clear
Clears information from the screen.
Syntax
clear field fieldname {, fieldname}
clear field all
clear screen
Description
The 4GL clear statement has three variants, as shown above.
clear field fieldname {, fieldname}
This statement clears one or more fields on the currently displayed form, initializing them to blank, zero, or null values depending on the nullability of each field.
The fieldname, a 4GL name, can be either the name of a simple field or the name of a table field; it cannot refer to a local variable. If fieldname names a table field, all the rows of the table field are cleared and the data set is deleted. Use mode update to restore cleared field values. Set_forms form (mode = update) does not restore old values.
You cannot directly clear a derived field. However, clearing one of its source fields has the effect of clearing the derived field.
If clear field fieldname or clear field all is embedded in an operation, such as a menu operation, the fields on the form are cleared at the end of the operation. The fields are not cleared until all the other statements in the operation are completed, and control returns to the calling screen. If you want to clear the fields before the operation is completed, place a redisplay statement immediately after the clear field statement.
clear field all
This statement clears all the displayed fields on the form. When the form is in Fill mode, it both clears displayed fields and assigns default values (although the default values are not displayed).
clear screen
This statement blanks out the entire terminal screen without clearing values from field data windows only for the duration of the operation in which it is embedded. It then redraws the screen and redisplays the data.
To control the number of seconds for which the screen is cleared, follow the clear screen statement with a sleep statement.
If the operation ends leaving the current terminal screen on display, the frame is redrawn. Typical uses of clear screen are to blank the frame temporarily while an operation is performed or before displaying a pop-up message, or to clean up as the application exits.
Examples
Clear the Name and Age fields in the current form:
clear field name, age;
Clear the field you specified in the field named Clearfield:
clear field :clearfield;
Clear all fields in the current form:
clear field all;
Present user with a blank screen for five seconds:
clear screen;
sleep 5;
Clear the screen in preparation for displaying a user prompt:
'Menu5' =
begin
clear screen; /* Blanks screen */
prmpt = prompt 'Enter the correct code';
/* Screen redrawn here */
end
Last modified date: 08/28/2024