Solved

form trigger hierarchy

Posted on 2001-08-06
18
4,006 Views
Last Modified: 2008-04-28
please throw some light on form trigger hierarchy.
0
Comment
Question by:surendranadh
  • 5
  • 4
  • 3
  • +3
18 Comments
 
LVL 22

Expert Comment

by:Helena Marková
ID: 6358188
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
0
 

Expert Comment

by:shikhadh
ID: 6358274
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
0
 
LVL 47

Expert Comment

by:schwertner
ID: 6358310
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
0
 
LVL 22

Expert Comment

by:Helena Marková
ID: 6358341
If you want to know something about the sequence of triggers you can see flowcharts in the on-line help.
0
 

Expert Comment

by:shikhadh
ID: 6358402
the sequence is not defined there i have already checked the online help
0
 
LVL 22

Expert Comment

by:Helena Marková
ID: 6358469
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.
0
 
LVL 4

Expert Comment

by:jtrifts
ID: 6358669
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
0
 
LVL 4

Expert Comment

by:jtrifts
ID: 6358705
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
0
 
LVL 3

Expert Comment

by:ramkb
ID: 6360890

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
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 47

Expert Comment

by:schwertner
ID: 6362721
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.
0
 
LVL 22

Expert Comment

by:Helena Marková
ID: 6363115
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.
0
 
LVL 4

Accepted Solution

by:
jtrifts earned 25 total points
ID: 6363122
Tx. Ramesh.

Schwertner.  I agree that the functionality of forms is predefined.  However, you cannot say that just because you know the names and types of triggers sitting on a form, that you can identify the absolute sequence of trigger fire for all scenarios...especially without knowing what other triggers will get fired as a result of the code within a particular trigger executing.

You can only say that type x occurs before type y at high levels.  That is why I suggested coming to grips with posting, validation, navigation...etc.

Again, true, every class of triggers has its own rules for firing...and that is the reason why flow diagrams for each class are so important.  I don't think it is naive to suggest that someone can learn from this.  I would not suggest that someone learn forms via Online help only, but at the same time, there IS alot of helpful info in the online help if you know what you're looking for.  And while yes, there are many syntactical examples and built-in detail, I think that if you think that's all it's good for, then perhaps either you haven't looked at it recently, or maybe you simply prefer an alternative method of learning.  But that simply means that it is not for you...it does not mean that it is for no-one.  

I myself am Oracle Certified, have taken forms courses over the years - Courses at Oracle, CBTs, and loads of self learning, both with the use of ORacle Education series books and via textbooks from Oracle Press, O'Reilly, etc.  In my experience, I don't think that there is only one way of learning, nor do I think that certain ways are completely devoid of merit.

What is important is what surendranadh can get out of this discussion (and those who follow the thread).  

At any rate...I'm jumping off my soapbox for the minute.  Thanks for your comments, even though I may take a contrary position to some of your points...but I guess that's what keeps it interesting.  :O)

JT
0
 
LVL 47

Expert Comment

by:schwertner
ID: 6364298
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.

 
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6836969
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.
http://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.
http://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.
http://www.experts-exchange.com/questions/Q.20110501.html
http://www.experts-exchange.com/questions/Q.20110888.html
http://www.experts-exchange.com/questions/Q.20121224.html
http://www.experts-exchange.com/questions/Q.20140953.html
http://www.experts-exchange.com/questions/Q.20146070.html
http://www.experts-exchange.com/questions/Q.20147758.html
http://www.experts-exchange.com/questions/Q.20147760.html
http://www.experts-exchange.com/questions/Q.20164315.html
http://www.experts-exchange.com/questions/Q.20164317.html
http://www.experts-exchange.com/questions/Q.20166543.html
http://www.experts-exchange.com/questions/Q.20166969.html
http://www.experts-exchange.com/questions/Q.20175720.html
http://www.experts-exchange.com/questions/Q.20182347.html
http://www.experts-exchange.com/questions/Q.20185408.html
http://www.experts-exchange.com/questions/Q.20232846.html
http://www.experts-exchange.com/questions/Q.20232848.html
http://www.experts-exchange.com/questions/Q.20241440.html
http://www.experts-exchange.com/questions/Q.20241006.html
http://www.experts-exchange.com/questions/Q.20243783.html
http://www.experts-exchange.com/questions/Q.20245963.html
http://www.experts-exchange.com/questions/Q.20256311.html
http://www.experts-exchange.com/questions/Q.20271849.html
http://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.
0
 
LVL 4

Expert Comment

by:jtrifts
ID: 6838693
I'll take points (or a share of them) if surendranadh takes no action.
Regards,
JT
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6863323
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.
http://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
http://www.experts-exchange.com/questions/Q.20109566.html
http://www.experts-exchange.com/questions/Q.20155849.html
http://www.experts-exchange.com/questions/Q.20162821.html
http://www.experts-exchange.com/questions/Q.20167178.html
http://www.experts-exchange.com/questions/Q.20169895.html
http://www.experts-exchange.com/questions/Q.20232868.html
http://www.experts-exchange.com/questions/Q.20246761.html
http://www.experts-exchange.com/questions/Q.20248942.html
http://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 http://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.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6864601
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
0
 
LVL 4

Expert Comment

by:jtrifts
ID: 6865461
Thanks Md.
Regards,
JT
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now