The Business Rules class is a custom, or non-visual, Visual FoxPro class. It contains methods that are called when certain processes occur within the application. For example, when a record is saved through a form the form’s Save method is run, which runs the data handler object’s SaveRecord method, which runs the PreSave method of the Business Rules object. This gives you three places to enter code, at the form level, at the data handler level (see the Code page in the Data Builder for a table, view, or cursoradapter), or at the Business Rules level.

 The Business Rules class is named VPMDataHandlerBusinessRules, and is located in the VPMDataHandlerBusinessRules class library. The ProDataHandlerBusinessRules class library contains a subclass of the VPMDataHandlerBusinessRules class named ProDataHandlerBusinessRules. However, all of the Business Rules class code is in the methods of the VPMDataHandlerBusinessRules class.

In a VPM Enterprise application the Business Rules object is instantiated by the data handler object each time the data handler object is instantiated, which is at application startup and at the instantiation of forms. After the Business Rules object has been instantiated its properties and methods can be referenced or called using the _SCREEN.oApp.oVPMDataHandler.oBusinessRules or <form object reference>.oVPMDataHandler.oBusinessRules object references. The Business Rules object is instantiated from a class that is specified in the cBusinessRulesClass and cBusinessRulesClass_ClassLibrary properties of the data handler object.

Class Browser

If you want to thoroughly explore the Business Rules class, open the class library in the Class Browser, which you can run from the VPM Enterprise Tools menu. Select the class name in the class list. Click on the Class Browser’s View Class Code button to have the Class Browser export the class code to a window. Then, print the class code. As you view the class code, properties will appear like memory variables and methods will appear as procedures.


VPMDataHandlerBusinessRules Class