Link to home
Start Free TrialLog in
Avatar of surendranadh
surendranadh

asked on

form trigger hierarchy

please throw some light on form trigger hierarchy.
Avatar of Helena Marková
Helena Marková
Flag of Slovakia image

This is from Forms on-line help (Trigger Definition Level and Scope):

When a trigger is created it is attached to a specific object, either an item, a block, or the form itself.  The object to which a trigger is attached determines the trigger's definition level in the object hierarchy.  For example, a trigger attached to a block named Customer has a definition level of block, and is said to be a "block-level trigger."
A trigger's definition level is important because it determines the trigger's scope.  The scope of a trigger is its domain within the Form Builder object hierarchy, and determines where an event must occur for the trigger to respond to it.

Trigger scope is defined as the trigger definition level (form, block, or item) and below. Thus, a block-level trigger fires if the trigger event occurs within that block, but it does not fire if the same event occurs in some other block.
Consider the When-New-Item-Instance trigger.  This trigger fires in response to the Enter the Item event, which occurs when the operator or the application navigates to a different item.  If the When-New-Item-Instance trigger is attached to a text item, it fires only when the operator enters that particular item.  If the same When-New-Item-Instance trigger were attached to the block, it would fire when the operator entered any item in that block.  Similarly, if the trigger were attached to the form, it would fire when the operator entered any item in any block in the form.

Precedence of Triggers that Respond to the Same Event  
It is common to define triggers at different levels that respond to the same event.  When an event occurs that is within the scope of more than one trigger, the trigger with the lowest definition level takes precedence.
For example, you might attach a When-New-Item-Instance trigger to a block, and another When-New-Item-Instance trigger to a text item in that block.  When the operator navigates to the text item, the item-level trigger fires, and the block-level trigger is ignored.

Restrictions on Trigger Definition Levels  
Some triggers can be defined only at a particular definition level. For example, the When-Validate-Record trigger, which fires when the Validate the Record event occurs, is only valid if attached to a block or to the form?it cannot be attached to an item. Most triggers, however, can be defined at the form, block or item level, and it is up to you to select the appropriate definition level to achieve the desired functionality.

There is also trigger Execution Hierarchy property - it's very important:

Specifies how the current trigger code should execute if there is a trigger with the same name defined at a higher level in the object hierarchy.
The following settings are valid for this property:

Override     Specifies that the current trigger fire instead of
any trigger by the same name at any higher scope.  This is known as "override parent" behavior - DEFAULT
Before     Specifies that the current trigger fire before firing the same trigger at the next-higher scope.  This is known as "fire before parent" behavior.
After     Specifies that the current trigger fire after firing the same trigger at the next-higher scope.  This is known as "fire after parent" behavior.

I hope that this will help you to understand form trigger hierarchy.

Henka
Avatar of shikhadh
shikhadh

but what about the sequence of triggers that fire.for eg when triggers,key next triggers,post text triggers.what is the sequence in which they fire
There are about 200 Forms triggers. Every class of triggers has his own sequence. You have to read this in the explanation of the THE PARTICULAR CLASS of triggers.

Example:

WHEN-MOUSE-ENTER
WHEN-MOUSE-LEAVE


WHEN-MOUSE-DOWN
WHEN-MOUSE-UP
WHEN-MOUSE-CLICK
WHEN-MOUSE-DOWN
WHEN-MOUSE-UP
WHEN-MOUSE-DOUBLECLICK
If you want to know something about the sequence of triggers you can see flowcharts in the on-line help.
the sequence is not defined there i have already checked the online help
Try to see flowcharts for Fetch Records or Post and Commit transaction. Also in the explanation of each trigger there is description about its firing. As Schwertner has said above you have to read help. You can start with Triggers (all) topic - triggers are divided there into groups.
Shikhadh,

The sequence is not etched in stone.  Part of it depends on what triggers are present and what effects the code in each trigger does...i.e. what path through the flow is taken.

That is why you need flow diagrams.  They show the path (which in turn will define the sequence) of trigger firing.

I understand your question...and it is fundamental to using forms properly (How can I program forms properly without knowing the order in which triggers will fire?).

But you really have to become familiar with the flow of processing.  As it is not strictly linear, you cannot simply say A fires then B, then C ...all the way to finally Z fires... for all cases.

In terms of hierarchy, the main point in the simplest terms is that if you use the default, you will get override behaviour where the item level will override the block level and the block level will override the form level, when each are present. I.E. The child overrides the parent.

Looking at it from another angle, you get the following hierarchy:

Pre- trigger --> On- Trigger --> Post- Trigger for a trigger of the same type at the same level.

I.E. A pre-insert will fire before an on-insert which will fire before the post-insert.

But a post- trigger that navigates to another block and changes a value of one item and then moves to another and commits will require validation and commit processing, so the flow can be complex.

If getting to know the precedence is an issue, I recommend printing out the flow diagrams and hanging them up on your wall for reference.  After a while you will get a sense of which triggers you need to perform certain activities and then which order they will file in the context of your own process flow.

You will need to come to grips with triggers for:
- posting (i.e. DML activities)
- validation (satisfaction of constraints and rules)
- query processing
- navigation (movement of focus around the form)
- coordination (for master-detail)

And when you do come to grips with those, then you need to get a handle on where restrictions exist for the use of built-ins.

Regards,

JT
To put it another way, Triggers respond to events.  The flow of processing for each trigger then depends on the event.  And the processing within a trigger itself can cause other events to occur which in turn will fire other triggers.

Thus the sequence depends on the scenario.  The simplest form, then is to look at the flow of each type of triggering event (there's a list you're well aware of in Forms online help) and determine what events those events themselves lead to.

You cannot say the On-insert will fire before the post insert for all occurrences of the the trigger as they may apply to different blocks and the post insert of block 1 may occur before the on insert of block 2 depending on the situation.

This is WHY you can't break the flow diagrams down into a strict linear sequence.

JT

That was the superb explanation of trigger flow and heirarchy I've ever seen.  I've worked in Forms for a long time (i no longer do) and I had to learn all these painstakingly.

Very well said, JT.

- Ramesh
Do not give wrong explanations and do not accept them. The functionality of Forms is prefifidened. This means that the transaction triggers fire on block events and the blocks post and commit sequentialy. The deletes are executed first, after that - inserts, updates.

Every class of triggers has his own rules and order of firing. Do not try to learn this from the on-line help - it is naive. On line help is to give the syntax of the statements and builtins mainly.

The philosophy of Forms is described in the Oracle student documents "Build Forms I" and "Buid Forms II". In fact these books are the base of the Oracle Certification Exam. This source and books based on this documents are the only source to understand the details.
I think that on-line help is useful for basic orientation in Forms. But many people don't read it. Also sometimes there is a problem with terminology when searching for informations.
ASKER CERTIFIED SOLUTION
Avatar of jtrifts
jtrifts
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi ,

I am just going to pass the Oracle "DEVELOPER/2000: Build Forms II" OCP exam. So to pass the exam I use one of the posible Selftest. Believe me - the basic source of knowledge (about principles of Forms, not about the details like parameters, entries) are the Oracle Students Books or may be something comparable. These books do not go in deep details - this is the task of the references and on-line help. But the principles are in the books, not in the on-line help. When you do not pass the exam (what hapens some times) Prometrics advices you to read the Oracle books, not the On-line helps. In fact the holly truth is that the principles can be find in the on-line help (very often) but they are so hidden that it is a hard task to find them.

Only if you have the basic knowledge you can understand the very compact explanation given on the on-line help.

This is a basic problem - written books (if good, of course) are the basic source, on-line help is additional.

This is not an attempt to argue, I only try to help.

 
23 OPEN QUESTIONS TODAY, ADMINISTRATION WILL BE CONTACTING YOU VIA EMAIL.  This is being added to all your open questions today.

This question appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, you must tell the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below, include the question QID/link.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this Help Desk link for Member Guidelines, Member Agreement and the Question/Answer process:  Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues.
https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

To view your open questions, please click the following link(s) and keep them all current with updates.
https://www.experts-exchange.com/questions/Q.20110501.html
https://www.experts-exchange.com/questions/Q.20110888.html
https://www.experts-exchange.com/questions/Q.20121224.html
https://www.experts-exchange.com/questions/Q.20140953.html
https://www.experts-exchange.com/questions/Q.20146070.html
https://www.experts-exchange.com/questions/Q.20147758.html
https://www.experts-exchange.com/questions/Q.20147760.html
https://www.experts-exchange.com/questions/Q.20164315.html
https://www.experts-exchange.com/questions/Q.20164317.html
https://www.experts-exchange.com/questions/Q.20166543.html
https://www.experts-exchange.com/questions/Q.20166969.html
https://www.experts-exchange.com/questions/Q.20175720.html
https://www.experts-exchange.com/questions/Q.20182347.html
https://www.experts-exchange.com/questions/Q.20185408.html
https://www.experts-exchange.com/questions/Q.20232846.html
https://www.experts-exchange.com/questions/Q.20232848.html
https://www.experts-exchange.com/questions/Q.20241440.html
https://www.experts-exchange.com/questions/Q.20241006.html
https://www.experts-exchange.com/questions/Q.20243783.html
https://www.experts-exchange.com/questions/Q.20245963.html
https://www.experts-exchange.com/questions/Q.20256311.html
https://www.experts-exchange.com/questions/Q.20271849.html
https://www.experts-exchange.com/questions/Q.20271850.html


PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:
 
Please leave any comments regarding this question here on closing recommendations if this item remains inactive another three days.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange


P.S.  For year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
I'll take points (or a share of them) if surendranadh takes no action.
Regards,
JT
A D M I N I S T R A T I O N   WILL BE CONTACTING YOU SHORTLY REGARDING YOUR ACCOUNT HERE AND YOUR OPEN QUESTIONS.  

In addition to all the questions listed above, these also remain open today.  

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 

To view your locked questions, please click the following link(s) and evaluate the proposed answer.estions
https://www.experts-exchange.com/questions/Q.20109566.html
https://www.experts-exchange.com/questions/Q.20155849.html
https://www.experts-exchange.com/questions/Q.20162821.html
https://www.experts-exchange.com/questions/Q.20167178.html
https://www.experts-exchange.com/questions/Q.20169895.html
https://www.experts-exchange.com/questions/Q.20232868.html
https://www.experts-exchange.com/questions/Q.20246761.html
https://www.experts-exchange.com/questions/Q.20248942.html
https://www.experts-exchange.com/questions/Q.20251054.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
This has been a lot of work and excellent input for a 25 point question (50 is recommended for "easy" questions) and numerous follow up requests ignored by the Asker.  Abandoned questions when help is requested and help given is very disheartening to me.

Finalized today.

Moondancer - EE Moderator
Thanks Md.
Regards,
JT