dataEvent_record_OnDefaultValues
Function called to initialize the business record with default values.
Syntax
PUBLIC FUNCTION dataEvent_record_OnDefaultValues(
currentRow record-type)
RETURNS (record-type)
The function has this parameter:
currentRow
. This is aRECORD
type defined in the generated common file (my_entity_common.4gl). It defines the current row in the business record according to the structure of the database table.
- record-type. This is a
RECORD
type defined according to the structure of the database table.
Usage
When you select the On Default Values property for the creation of the event, a function shell is created. Enter your code in the function.
This function is called to initialize the business record with default values. Use this function if you need to change a default value, or if you want to set a default value for a field that does not have a default value defined in the database schema.
Example: OnDefaultValues
This example uses the On Default Values event for the Account table in the OfficeStore demo.
In this example, the value for the "langpref" field is set to "English". As a result, the default
value is set for this field in the return record currentRow
.
PUBLIC FUNCTION dataEvent_recAccount_OnDefaultValues(currentRow recAccount_br_type)
RETURNS (recAccount_br_type)
DISPLAY "dataEvent_recAccount_OnDefaultValues (Row scope) is raised"
LET currentRow.account_langpref = "English"
DISPLAY "dataEvent_recAccount_OnDefaultValues (Row scope) is exited"
RETURN currentRow.*
END FUNCTION