dbxDataEvent_tableName_SetDefaultValues
Function called to initialize the record with default values.
Syntax
PUBLIC FUNCTION dbxDataEvent_tableName_SetDefaultValues(
p_data record-type)
RETURNS (record-type)
The function has the following parameter:
p_data
. This is aRECORD
type defined 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 Set 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 form fields with default values from the database schema. It is called before a row is inserted. You use it if you want to add a default value for a field that does not have a default value defined in the database schema, or if you want to change the default value defined in the database schema.
Example: Set Default Values
This example uses the Set 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 form in the return record p_data
.
PUBLIC FUNCTION dbxDataEvent_account_SetDefaultValues(p_data RECORD LIKE account.*)
RETURNS (RECORD LIKE account.*)
DISPLAY "dbx dataEvent_account_SetDefaultValues (Table scope) is raised"
LET p_data.langpref = "English"
DISPLAY "dbx dataEvent_account_SetDefaultValues (Table scope) is exited"
RETURN p_data.*
END FUNCTION