Controlling Data Block Relationships
http://ebiztechnics.blogspot.com
Objectives
• Define block coordination
• Coordinate data blocks by using REF relations
• Describe the characteristics and
principles of relation-handling code
• System Variables for obtaining relation handling information
• Implement a coordination-type toggle
• Force one commit per master record
http://ebiztechnics.blogspot.com
Relations
• Logical objects that handle the relationship between two blocks
• Created implicitly with a master-detail form module
• Created explicitly with the New Relation dialog box
http://ebiztechnics.blogspot.com
Block Coordination
• Coordination-causing event
• Block-coordination phases:
– Clear phase executed before change
of master record
– Populate phase executed after
change of master record
• Implementation of block coordination:
– The Copy Value from Item property
– Relation-handling triggers
– Relation-handling procedures
http://ebiztechnics.blogspot.com
Creating REF Relationships
http://ebiztechnics.blogspot.com
Characteristics of Relation-Handling Triggers
• On-Clear-Details: Implements the Clear phase
• On-Populate-Details: Implements the
Populate phase
• On-Check-Delete-Master: Implements the restricted-delete rule
• Effect of trigger failure
http://ebiztechnics.blogspot.com
Principles of Relation-Handling Code
Three relation-handling procedures:
• CLEAR_ALL_MASTER_DETAILS
• QUERY_MASTER_DETAILS
• CHECK_PACKAGE_FAILURE
Adding your own code to relation-handling triggers:
• Forms adds comments around code.
• You add your own code before or after
these comments.
http://ebiztechnics.blogspot.com
Obtaining Relation-Handling Information
System variables for relation handling:
• SYSTEM.MASTER_BLOCK
• SYSTEM.COORDINATION_OPERATION
Built-ins for relation handling:
• GET_FORM_PROPERTY
• GET/SET_BLOCK_PROPERTY
• GET/SET _RELATION_PROPERTY
http://ebiztechnics.blogspot.com
Implementing Coordination-Type Toggle
Define a procedure that toggles between
immediate and deferred coordination
• Use GET_BLOCK_PROPERTY to obtain
relation name.
• Use GET_RELATION_PROPERTY to
obtain current coordination type.
• Use SET_RELATION_PROPERTY to
switch to other coordination type.
Call this procedure from:
• When-Checkbox-Changed trigger
• Menu item of type Check
http://ebiztechnics.blogspot.com
Forcing a Commit Per Master
Define a procedure that:
• Updates the commit status by
performing validation
• Checks the commit status of the master record
• Raises FORM_TRIGGER_FAILURE in
case of changes
Call the procedure:
• In the On-Clear-Details trigger
• Before the “Begin default relation
program section” comment
http://ebiztechnics.blogspot.com
Summary
• Define Relation coordination properties
• Manage data block coordination
– Coordination-causing events change
the master record
– Clear and populate
• System Variables for obtaining relation handling
information
http://ebiztechnics.blogspot.com

Oracle Forms: Master Detail form

  • 1.
    Controlling Data BlockRelationships http://ebiztechnics.blogspot.com
  • 2.
    Objectives • Define blockcoordination • Coordinate data blocks by using REF relations • Describe the characteristics and principles of relation-handling code • System Variables for obtaining relation handling information • Implement a coordination-type toggle • Force one commit per master record http://ebiztechnics.blogspot.com
  • 3.
    Relations • Logical objectsthat handle the relationship between two blocks • Created implicitly with a master-detail form module • Created explicitly with the New Relation dialog box http://ebiztechnics.blogspot.com
  • 4.
    Block Coordination • Coordination-causingevent • Block-coordination phases: – Clear phase executed before change of master record – Populate phase executed after change of master record • Implementation of block coordination: – The Copy Value from Item property – Relation-handling triggers – Relation-handling procedures http://ebiztechnics.blogspot.com
  • 5.
  • 6.
    Characteristics of Relation-HandlingTriggers • On-Clear-Details: Implements the Clear phase • On-Populate-Details: Implements the Populate phase • On-Check-Delete-Master: Implements the restricted-delete rule • Effect of trigger failure http://ebiztechnics.blogspot.com
  • 7.
    Principles of Relation-HandlingCode Three relation-handling procedures: • CLEAR_ALL_MASTER_DETAILS • QUERY_MASTER_DETAILS • CHECK_PACKAGE_FAILURE Adding your own code to relation-handling triggers: • Forms adds comments around code. • You add your own code before or after these comments. http://ebiztechnics.blogspot.com
  • 8.
    Obtaining Relation-Handling Information Systemvariables for relation handling: • SYSTEM.MASTER_BLOCK • SYSTEM.COORDINATION_OPERATION Built-ins for relation handling: • GET_FORM_PROPERTY • GET/SET_BLOCK_PROPERTY • GET/SET _RELATION_PROPERTY http://ebiztechnics.blogspot.com
  • 9.
    Implementing Coordination-Type Toggle Definea procedure that toggles between immediate and deferred coordination • Use GET_BLOCK_PROPERTY to obtain relation name. • Use GET_RELATION_PROPERTY to obtain current coordination type. • Use SET_RELATION_PROPERTY to switch to other coordination type. Call this procedure from: • When-Checkbox-Changed trigger • Menu item of type Check http://ebiztechnics.blogspot.com
  • 10.
    Forcing a CommitPer Master Define a procedure that: • Updates the commit status by performing validation • Checks the commit status of the master record • Raises FORM_TRIGGER_FAILURE in case of changes Call the procedure: • In the On-Clear-Details trigger • Before the “Begin default relation program section” comment http://ebiztechnics.blogspot.com
  • 11.
    Summary • Define Relationcoordination properties • Manage data block coordination – Coordination-causing events change the master record – Clear and populate • System Variables for obtaining relation handling information http://ebiztechnics.blogspot.com

Editor's Notes

  • #7 Technical Note If you specify a cascade-delete foreign key rule for a relation. Form Builder uses a Pre-Delete trigger to implement this rule. However, This is a commit trigger. Not a relation-handling trigger, and can also Be used outside the context of relations.
  • #9 Technical Note You can use these system variables in the On-Clear-Details trigger only. Assign their values to global variables to broaden the scope.