The EGL set statement
serves two purposes, depending
on context:
A data access statement that targets a record variable
A UI statement that targets a form or a field within a form
In both cases, the statement changes some specified value in
the target.
This topic presents the core information common to all forms of the set statement;
for behavior in a specific context, see the related references at
the end
of this topic.
Core syntax
target
A record variable, a form, or a form field. For more on these
variations,
see below.
value
The value the set statement assigns
to the target.
These values depend on the specific target of the statement; for more
information,
see below.
set with record variable
as target
When performing data access, the target
of the set statement
is a record variable. Some or all of the following values might be
available:
empty
This
variant of the set statement works recursively
through any record variables contained within the record, or, in the
case
of a structured record, works down to the lowest level of the structure.
Individual
fields are set to their default values according to their types and
the null
flag is turned on. For more information about default values, see Data initialization.
For more information about the null flag, see isSQLNullable.
initial
A record variable can
specify an initial value for each of its fields.
The initial modifier resets the values of
those
fields to the values specified in the record definition. If the record
definition
does not specify any initial values, the effect of the initial modifier
is the same as that of the empty modifier.
position
For
record variables with certain stereotypes (such as Indexed Record),
you can use the set statement to set the
file pointer
within the file before a get next or get
previous statement. The set statement
effectively positions the file pointer to match the key field in the
specified
record variable. For details, see the related reference section at
the end
of this topic for set considerations for
the appropriate
data access technologies.
You can specify
multiple records and multiple values, separated by commas.
For a given record, the options take effect in the order in which
they appear
in the set statement.
set with field
as target
When the target of the set statement
is a field,
the following values are available for any field (on a form or in
a record):
empty
This
variant of the set statement clears the
specified field; if the field is structured, the statement also clears
all
subordinate fields. For the values assigned, see Data initialization.
initial
This variant of the set statement resets
the
value of the field to the value specified in the record definition.
If the
record definition does not specify any initial values, the effect
of the initial modifier
is the same as that of the empty modifier.
To explicitly set a nullable field or variable
to a null value, do not
use a set statement. Use an assignment statement
like the following example: