J. Notes for Users of QUEL : QUEL Notes for the Writing 4GL Statements Chapter : Field Activations on Entry and Exit
 
Share this page                  
Field Activations on Entry and Exit
The 4GL statements that accompany a field activation are executed whenever the user enters or leaves the field, as in this example:
field empnum = 
begin
  if empnum = 0 or empnum is null then
    message 
      "Please enter an employee number";
    sleep 3;
  else
    empform := retrieve (employee.fname,
      employee.lname)
      where employee.num = empnum;
    resume field "lname";
  endif;
end
When the user leaves the empnum field, Ingres checks the value in the field.
If the value in the field is zero, it issues the error message and returns the cursor to the empnum field.
If the value in the field is not zero, it retrieves the employee's name from the database and positions the cursor at the lname field.