Home » Developer & Programmer » Forms » business rule enforced at commit time
business rule enforced at commit time [message #164928] Mon, 27 March 2006 11:46 Go to next message
bdrufner
Messages: 42
Registered: August 2005
Location: Home of the Mardi Gras, N...
Member
Forms 9.0.4, RDBMS 9.2

I have a master/detail form. The master block is named CLASS and the detail block is named SESSION. For every CLASS, there must be at least one but could be several SESSIONS. Inside each data block is a data item named CEU HOURS.

In theory, I am trying to enforce a business rule that compares the value of CLASS CEU HOURS for one class to the sum of all SESSION CEU HOURS for the class in question. These values will be written to seperate tables when committed to the RDBMS ( SESSION table and CLASS table).

I am using an ON-INSERT trigger at the CLASS data block level. When I successfully complete this syntax, I will have to copy the same code to my ON-UPDATE trigger for the same data block. I can compare the CLASS CEU HOURS value to the SESSION CEU HOURS value as long as there is only one session, but when there are multiple sessions, I am unable to generate a solution.

Questions: (1) is there a better way then to have the same code in two triggers (ON-INSERT and ON-UPDATE)? (2) Is there a way to aggregate the value of SESSION CEU HOURS for multiple detail rows and compare that value to CLASS CEU HOURS for a spoecific class?

Any ideas, suggestions, comments and/or example syntax is very much appreciated.

Thanks
Barry
Re: business rule enforced at commit time [message #165012 is a reply to message #164928] Tue, 28 March 2006 00:28 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
To run the same code in two triggers consider creating a procedure or function within your form.

About validating, I ALWAYS suggest that you do your validation in a When-Validate-Item or When-Validate-Record trigger.

About the sum of values, search this forum for 'Calculation' or 'Summary function'.

David
Previous Topic: .......... Dynamic Table selection
Next Topic: Oracle forms on internet
Goto Forum:
  


Current Time: Fri Sep 20 07:27:24 CDT 2024