Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : CLEAR statement
 

CLEAR statement

Clears the data for all fill-in fields in a frame. It also clears the colors for all widgets in a frame, except for enabled fill-ins.
Note: Does not apply to SpeedScript programming.

Syntax

CLEAR [ FRAME frame ] [ ALL ] [ NO-PAUSE ]
FRAME frame
Represents the name of the frame containing the fill-in fields you want to clear. If you do not name a frame, CLEAR clears the default frame for the block containing the CLEAR statement.
ALL
Clears all occurrences and resets the current display position to the top of the frame for a down frame (a frame used to display several occurrences of the fields in the frame).
NO-PAUSE
Does not pause before clearing the frame.

Example

The r-clear.p procedure displays the ABL data types and their corresponding default formats. The procedure prompts you to enter values so you can see how ABL formats those values. If you answer YES, the AVM clears the values currently displayed so that you can enter new values.
r-clear.p
DEFINE VARIABLE a AS CHARACTER NO-UNDO INITIAL "xxxxxxxx".
DEFINE VARIABLE b AS DATE      NO-UNDO INITIAL TODAY.
DEFINE VARIABLE c AS DECIMAL   NO-UNDO INITIAL "-12,345.67".
DEFINE VARIABLE d AS INTEGER   NO-UNDO INITIAL "-1,234,567".
DEFINE VARIABLE e AS LOGICAL   NO-UNDO INITIAL TRUE.

DISPLAY "This illustrates the default formats for the different data types"
  SKIP (2) WITH CENTERED ROW 4 NO-BOX FRAME head.
FORM "CHARACTER default format is ""x(8)"" " a SKIP
"DATE default format is 99/99/99 " b SKIP
"DECIMAL default format is ->>,>>9.99 " c SKIP
"INTEGER default format is ->,>>>,>>9 " d SKIP
"LOGICAL default format is yes/no " e TO 55 SKIP
WITH ROW 8 NO-BOX NO-LABELS CENTERED FRAME ex.

REPEAT:
DISPLAY a b c d WITH FRAME ex.
MESSAGE "Do you want to put in some values?"
UPDATE e.
IF e THEN DO:
CLEAR FRAME ex NO-PAUSE.
SET a b c d WITH FRAME ex.
END.
ELSE LEAVE.
END.

Notes

*The CLEAR statement only clears fill-in fields. GUI widgets such as editors or radio-sets are not affected.
*The AVM automatically clears a single (1 down) frame whenever its block is iterated, and automatically clears a multi-frame (down frame) whenever it is full and its block is iterated.
*When clearing colors for a field-level widget in a frame, the CLEAR FRAME statement honors all widget attribute and option settings that specify how the widget inherits foreground or background colors from its containing frame.
*To clear the data from a single fill-in without clearing its colors, use the CLEAR( ) method (FILL-IN Widget).