Was this helpful?
Set_4gl
Sets the behavior of a tablefield, array, or record when a select statement returns zero rows.
Syntax
set_4gl (clear_on_no_rows = value)
The value is one of the following:
off | 0
Indicates the select target is left undisturbed if no rows are returned
on | 1
Indicates the select target is cleared if no rows are returned. This is the default behavior.
The value can also be a variable or a 4GL expression that evaluates to 0 or 1.
Description
This statement allows you to dynamically set the behavior of a tablefield, array, or record when selecting data. Use the clear_on_no_rows keyword to indicate whether the tablefield, array, or record is cleared if the select statement returns zero rows.
The clear_on_no_rows keyword has no effect if the select target is a form: the form is never automatically cleared.
You can check the current value of clear_on_no_rows with the inquire_4gl statement. See Inquire_4gl.
Examples
Use the variable intvar to change the behavior of the table field before issuing a select:
intvar = 0;
set_4gl (clear_on_no_rows = :intvar);
Change behavior back to clear table field behavior:
set_4gl (clear_on_no_rows = 1);
Or:
set_4gl (clear_on_no_rows = on);
Last modified date: 04/03/2024