dataEvent_record_OnComputedFields
Function called to manage the fields in the business record.
Syntax
PUBLIC FUNCTION dataEvent_record_OnComputedFields(
currentRow record-type INOUT)
The function has one parameter:
currentRow
. This is aRECORD
type defined in the BAM-generated common file (my_entity_common.4gl). It defines the current row in the business record according to the structure of the database table. It is passed by reference (INOUT
), which means that changes made to the record inside the function are returned.
Usage
When you select the On Computed Fields property for the creation of the event, a function shell is created. Enter your code in the function.
Use this function to modify the fields in the business record. This provides you with an opportunity to modify any of the record fields before the values are sent to the report, form, or Web service.
Example: OnComputedFields
This example uses the On Computed Fields code event for the Account Report Data entity in the OfficeStore demo.
In this example, the value for the country_codedesc is prepended with the string "Country: ". As a result, the new value is printed for each row in the report.
PUBLIC FUNCTION dataEvent_Account_OnComputedFields(currentRow Account_br_type INOUT)
DISPLAY "dataEvent_Account_OnComputedFields (Row scope) is raised"
DISPLAY "currentRow.account_userid: ",currentRow.account_userid
DISPLAY "Old currentRow.account_codedesc: ",currentRow.country_codedesc
LET currentRow.country_codedesc = "Country: ",currentRow.country_codedesc
DISPLAY "currentRow.account_userid: ",currentRow.account_userid
DISPLAY "New currentRow.account_codedesc: ",currentRow.country_codedesc
DISPLAY "dataEvent_Account_OnComputedFields (Row scope) is exited"
END FUNCTION