Forms-Based Application Development Tools User Guide > Part 4: Embedded Forms Programming > Forms Statements > breakdisplay statement--Terminate a Display Loop or Submenu
Was this helpful?
breakdisplay statement--Terminate a Display Loop or Submenu
This statement terminates a display loop or a display submenu without performing field validations or executing the finalize statement.
Syntax
breakdisplay
Description
The breakdisplay statement terminates a display loop, returning control to the first statement in the program following the end of the display block. (For information about the structure of display blocks, see Part 4: Embedded Forms Programming.) Unlike the enddisplay statement, breakdisplay does not perform a validation check on the fields in the form nor does it execute the finalize statement.
The breakdisplay is particularly useful if you do not want to retain the data in the form, because validation checking is unnecessary in such instances.
The breakdisplay statement must be syntactically within the scope of a display block, as it generates a local goto statement to the end of the block. If the breakdisplay statement is inside an unloadtable statement which is itself nested in an activate section, breakdisplay exits the unloadtable loop, in addition to terminating the display loop. The second example demonstrates this.
Examples--breakdisplay statement:
Example 1:
The Quit operation terminates display of the form without validation checking.
exec frs display empform;
 exec frs initialize;
 exec frs activate menuitem 'Browse';
exec frs begin;
    Browse and update the data on the form;
exec frs end;
 exec frs activate menuitem 'Quit';
exec frs begin;
    exec frs breakdisplay;
exec frs end;
 exec frs finalize;
Example 2:
The table field is unloaded within the Scan menu section. If an error is detected, breakdisplay terminates both the display and the unloadtable loops.
exec frs display empform;
 ...
 exec frs activate menuitem 'Scan';
exec frs begin;
    ...
    exec frs unloadtable empform employee 
        (:child = child, :age = age);
    exec frs begin;
        ...
        if (error) then
           exec frs message 'Aborting scan on error';
           exec frs sleep 2;
           exec frs breakdisplay;
        end if;
    exec frs end;
exec frs end;
 exec frs finalize;
/* breakdisplay transfers control here. */
Example 3:
Use the breakdisplay statement in a display submenu display block.
exec frs display 'form';
 exec frs activate menuitem 'Utilities';
exec frs begin;
    exec frs display submenu;
    exec frs activate menuitem 'Delete';
    exec frs begin;
        do delete based on data on form;
    exec frs end;
    exec frs activate menuitem 'File';
    exec frs begin;
        Place data on form into a file;
    exec frs end;
    exec frs activate menuitem 'End';
    exec frs begin;
        /* Exit from the submenu display block */
        exec frs breakdisplay;
    exec frs end;
    exec frs finalize;
exec frs end;
exec frs activate menuitem 'Done';
exec frs begin;
    /* exit from form display block */
    exec frs breakdisplay;
 exec frs end;
 exec frs finalize;
Last modified date: 08/28/2024