Calling the Business Rules Methods

To successfully write data-related business rules code, you need to know where and in what order VPME runs the code that you put into Business Rules class methods and Data Builder record-level and field-level code.

Generally, calls to Business Rules class methods and Data Builder code originate in the clicking of a VPME form toolbar button. Clicking a toolbar button runs its associated method of the form. The form method then runs its associated method of the formís Data Handler object. The Data Handler method then executes Data Handler methods, Business Rules object methods and Data Builder code to perform the data handling task associated with the toolbar button.

The table below shows the sequence in which code is executed starting with each form data handling method. Column 1 shows the form method that originates a call and passes parameters to the Data Handler object method in column 2. Column 3 shows the Business Rules object method that is called by the Data Handler object method in column 2. Column 4 shows the Data Builder code snippet name that is called by the Data Handler object method in column 2. With each method call, parameters are passed. The methods and code are executed in the order of the table rows.

(1)
Form
Method

(2)
Data Handler Object Method

(3)
Business Rules
Method

(4)
Data Builder Method

AddNew

AddRecord

PreAdd

PreAdd

 

 

PostAdd

PostAdd

Copy

AddRecord

PreCopy

PreCopy

 

 

PostCopy

PostCopy

Delete & GroupDelete

DeleteRecord

PreDelete
PreTransaction

PreDelete
PreTransaction

 

 

PreDelete

PreDelete

 

 

PostDelete

PostDelete

 

 

PostDelete
PostTransaction

PostDelete
PostTransaction

Restore

RestoreRecord

PreRestore

PreRestore

 

 

PostRestore

PostRestore

Save

SaveRecord

PreSave
PreTransaction

PreSave
PreTransaction

 

 

PreSave

PreSave

 

FieldValidation_
RecordLevel

 

 

 

FieldValidation

PreFieldValidation

PreValidation

 

 

FieldValidation

 

 

 

PostFieldValidation

PostValidation

 

 

 

 

Tip: Outside of a form, calls to the Business Rules methods would originate with a call to the Data Handler object method in column 2.

Field Validation Method Calls

The calls to Business Rules methods illustrated in the table above originate with record-level data handling functions.

The Field Validation methods of the Business Rules object are also called when a field is validated on a form. When a field is validated on a form, the Valid event of the fieldís control calls the AdminTool_FieldValidation method of the form, which then calls the FieldValidation method of the formís Data Handler object. From that point, the Business Rules Field Validation methods and the Data Builder field validation code is executed as shown for the form Save function in the table above.

More:

Business Rules Method Parameters