17. Forms Statements : set_frs Statement--Set FRS Features : Setting the Change Variable
 
Share this page                  
Setting the Change Variable
There is a change variable associated with each field in a form and each displayed column in a table field. If a table field has a data set, then each value in the data set has an associated change variable. The change variable for a field is set if a user types into the field. The clearrest FRS command, mapped to the Return key on many terminals, sets the change variable. The change variable is cleared at the start of a display loop, when the field is cleared, or when a new value is placed into the field by the program.
To set the change variable for a field, use the following syntax:
set_frs field formname
    (change[(fieldname)] = value
    {, change[(fieldname)] = value})
To set the change variable for a table field, use the following syntax:
set_frs row formname tablename [row]
    (change(columnname) = value
    {, change(columnname) = value})
The form objects can be expressed as string constants, with or without quotes, or as program string variables.
The row identifies a row in the referenced table field display. If the table field has a data set, then row can refer only to rows that actually have displayed data. For example, if the table field can display five rows, but only three actually display data when the statement is issued, then row can be 1, 2, or 3. The first row in the table field is always numbered 1. If you do not specify row, the statement refers to the row on which the cursor is currently resting.
You can never specify row if the statement appears in an unloadtable loop. In such cases, the statement always refers to the row just unloaded.
Value must be either an integer literal of 0 or 1 or an integer variable evaluating to 0 or 1. A value of 0 clears the change variable to make it appear that the runtime user had not typed into the field. The value 1 sets the change variable.
The following statement clears the change variable for a field:
exec frs set_frs field empform (change(empname) = 0);
The following statement sets the change variable for two columns in a table field:
exec frs set_frs row partsform partstable 1
    (change(partnumber) = 1, change(partdescription) = 1);
There are additional examples at the end of the inquire_frs statement description.