Example: orders.4gl (Function order_validate)

This function validates the entries in the fields of the orders screen record.

Function order_validate (orders.4gl):

  1 PRIVATE FUNCTION order_validate(d ui.Dialog) RETURNS BOOLEAN
  2 
  3   IF d.validate("orders.*") < 0 THEN RETURN FALSE END IF
  4 
  5   RETURN order_check(d)
  6 
  7 END FUNCTION
Note:
  • Line 01 The dialog object is passed to this function, allowing the use of methods of the DIALOG class.
  • Lines 3 performs a dialog validation process, checking form field constraints such as NOT NULL. If the function fails to validate the user input, we return FALSE.
  • Line 5 calls the order_check function to verify order header fields and returns the value returned by this function.