When entering information into a field, the data is kept in the ‘field buffer’ until the cursor is moved to another field or the Input statement is completed i.e., by pressing the Accept key. Only then the data stored in the field buffer will be written to the underlying variable. Sometimes, it is required to do some processing with the data from a field (field buffer) without terminating the input statement. For this situation, fgl_dialog_update_data() or dialog.update_data() can be called to write any data from the field buffers to the underlying variables.
fgl_dialog_update_data() and dialog.update_data() allow the application developer to write data from a specific field to the input variable before saving all data on the entire page. Essentially this affords the ability to capture data in a particular field without capturing the data in every field on that page. In effect this script is the opposite of the Field Buffer Function, and can be utilised via implementation of either of the following syntax examples:
fgl_dialog_update_data()
dialog.update_data()
In the example below, the entered data will be displayed in the form message string after pressing the F2 button:
MAIN
DEFINE
f1 char(5)
OPEN WINDOW w1 WITH FORM "fgl_dialog_update_data_function"
INPUT BY NAME f1 WITHOUT DEFAULTS
ON KEY (F2)
CALL fgl_dialog_update_data()
MESSAGE "f1=", f1
END INPUT
CLOSE WINDOW w1
END MAIN
.per form code
DATABASE FORMONLY
SCREEN
{
[f1 ]
}
ATTRIBUTES
f1=FORMONLY.f1;
INSTRUCTIONS
SCREEN RECORD s_rec (
FORMONLY.f1
)
DELIMITERS "[]"