Example: orders.4gl (Function order_check)
This function verifies the values of the order header fields.
Function
order_check
(orders.4gl) 1 PRIVATE FUNCTION order_check(d ui.Dialog) RETURNS BOOLEAN
2
3 IF d.getFieldTouched("orders.order_date")
4 AND order_rec.order_date < TODAY THEN
5 ERROR msg12
6 RETURN FALSE
7 END IF
8
9 RETURN TRUE
10
11 END FUNCTIONNote:
- Line
1defines the function with aui.Dialogobject as parameter. The dialog object will be provided by the dialog instruction by passing theDIALOGkeyword as parameter. The function returnsTRUEif the current order header values are ok. - Line
3verifies if the order date field has been touched: We only want to check values entered by the user. If the date is in the past, we show an error message and returnFALSE. - Line
9returnsTRUE, indicating that the order heaser fields are ok.