If the Logical View shares a database-generated key value with an underlying table, you need to take special action if (on Insert into the view) your special rules are going to write that key value into multiple underlying tables. Write a transitional Update constraint against the view that retrieves the next generated key value ahead of time, in other words, before the user action on the view is translated to actions on underlying tables:
|1.||Invoke the GetNextGeneratedUniqueValue() method of the internal <table name> component. The generic INVOKE syntax is:|
INVOKE <table name>.GetNextGeneratedUniqueValue()
|but you can replace the INVOKE keyword by function call Syntax a typical SQL statement of a transitional Update constraint retrieving the key value will look like this:|
UPDATE <rule-based logical view>
SET <primary key> = <underlying table>.GetNextGeneratedUniqueValue()
WHERE <primary key> IS NULL
|2.||Write your special rules as transitional constraints on the Logical View (meaning that the Transition Table attribute is set to the name of the Logical View and you use one or more of the Fire On... flags). You have a design choice here:|
•You can define all the desired behavior on the constraints themselves.
•Alternatively, you can have a transitional constraint call a USoft batch job that executes the desired behavior. Start the constraint SQL with
INVOKE BatchRunner.<job name> WITH SELECT ... .
|3.||Before testing, debugging or maintaining the solution, make sure that all the transitional constraints are Active and Correct. |
|TIP: The "Rule-based Implementation" tab in the Logical View tab or window helps you with this step.|