Views with "instead of" triggers
Sometimes in Infor Public Sector there is a need to create agency business objects that can access tables in other databases or systems. This can be accomplished by creating the agency business object and then associating it with a database view. Depending on the purpose, the view can be either read-only or updatable. The underlying tables for the view can come from any type of data.
The general procedure is outlined below.
- In the Schema Manager, define an agency table with a table type of “View.” Use the Synchronize command to generate the business object.
- Create a database view that mimics the structure you defined in the Schema Manager. You can have additional columns, but you must include all that are defined in the business object. Creating a view in the Schema Manager doesn’t create the actual view in the database, just the business object that will interact with the view.
- Create an “instead of” trigger on the view. If you want it to be read-only then point everything to NULL, as shown in the first example below. If you want some columns to be updatable then code in the update.