2. 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
3. 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
4. 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
6. 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
7. 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
8. 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
9. 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
10. 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
11. 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
Notas del editor
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.
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.