Validation & Navigational Triggers
http://ebiztechnics.blogspot.com
Objectives
• What is Validation Unit?
• Form Builder Validation Properties
• Using triggers to implement Validation
• Navigation in Forms
• Navigation Properties
• Navigational Triggers
• Built-ins used for Navigation
http://ebiztechnics.blogspot.com
Validation in Form Builder
• Form Builder provides the Validation at 4 Levels:
Form Level
Block Level
Record Level Item Level
http://ebiztechnics.blogspot.com
Validation
• Validation occurs when:
– Enter key is pressed or ENTER Built-in execute.
– Operator or trigger leaves the validation unit (includes a Commit)
http://ebiztechnics.blogspot.com
Validation Property
Form Module
Properties -> Database->
Validation Unit
http://ebiztechnics.blogspot.com
Validate from list
• Text item Property
• Used to validate from LOV
• If the input value does not exist in LOV the List of values window
appears to choose.
• Note: Do not use this property for large number of values.
http://ebiztechnics.blogspot.com
Validation Triggers
• Item Level
– When-Validate-Item
• Block Level
– When-Validate-Record
IF :emp.ename is null or :emp.hiredate is null THEN
message(‘Employee name or
Joining Date can not be blank’);
RAISE form_trigger_failure;
END IF;
http://ebiztechnics.blogspot.com
Validating User Input
• Salary Details Form.
7987Emp No When-Validate-Item
SELECT ……….
FROM emp
WHERE empno=:empsal.empno;
Trigger Failure
http://ebiztechnics.blogspot.com
Validation Status
• NEW
– When a record is created
– Also for Copy Value from Item or Initial Value
• CHANGED
– When changed by user or trigger
– When any item in new record is changed
• VALID
– When validation has been successful
– After records are fetched from database
– After a successful post or commit
– Duplicated record inherits status of source
http://ebiztechnics.blogspot.com
Built-ins for Validation
• CLEAR_BLOCK, CLEAR_ FORM, EXIT_FORM
• ENTER
• SET_FORM_PROPERTY
– (..., VALIDATION)
– (..., VALIDATION_UNIT)
• ITEM_IS_VALID item property
• VALIDATE (VALIDATION_ UNIT)
SET_FORM_PROPERTY(‘FORM_MOD’,VALIDATION_UNIT,
);ITEM_SCOPE
RECORD_SCOPE / BLOCK_SCOPE / FORM_SCOPE
http://ebiztechnics.blogspot.com
Navigation in forms
• What is Navigational Unit?
• Navigation in
– Form
– Block
– Record
– Item
• Entering and Leaving Objects
• What happens if navigation fails?
http://ebiztechnics.blogspot.com
Navigation Properties
• Form module
– Mouse navigation limit
– First navigation data block
• Block
– Navigation style
– Previous navigation data block
– Next navigation data block
• Item
– Enabled
– Keyboard navigable
– Mouse navigate
– Previous navigation item
– Next navigation item
http://ebiztechnics.blogspot.com
Navigation in Blocks
Exit item
Exit record
Exit block
Enter block
Enter record
Enter item
http://ebiztechnics.blogspot.com
Internal Navigation
Exit item
Exit record
Enter record
Enter item
http://ebiztechnics.blogspot.com
Navigational Triggers
When-New-“object”-Instance
Fire after navigation
Does fire when validation unit is
higher than the trigger object
Allow restricted and
unrestricted built-ins
Are not affected by failure
Pre- and Post-
Fire during navigation
Does not fire if validation unit
is higher than trigger object
Allow unrestricted built-ins
Handle failure by returning to
initial object
http://ebiztechnics.blogspot.com
Pre- and Post- Triggers
• Pre/Post-Form
• Pre/Post-Block
• Pre/Post-Record
• Pre/Post-Text-Item
http://ebiztechnics.blogspot.com
Example Pre-Block Trigger
IF GET_APPLICATION_PROPERTY(username)=‘SCOTT’ THEN
SET_BLOCK_PROPERTY(‘EMP’,UPDATE_ALLOWED,
Property_False);
END IF;
http://ebiztechnics.blogspot.com
When-New-”object” Instance
• When-New-Form-Instance
• When-New-Block-Instance
• When-New-Record-Instance
• When-New-Item-Instance
http://ebiztechnics.blogspot.com
Examples
SET_FORM_PROPERTY(‘EMPL’, VALIDATION_UNIT,
RECORD_SCOPE);
SET_BLOCK_PROPERTY(‘EMP’, QUERY_ALLOWED, PROPERTY_FALSE);
READ_IMAGE_FILE(‘E_’||:emp.empno||’.bmp’,’BMP’,
’emp.emp_image);
SET_ITEM_PROPERTY(:SYSTEM.cursor_item,
visual_attribute, ‘vared’);
http://ebiztechnics.blogspot.com
Navigational Trap
Pre-Text-Item
Pre-Text-Item
Post-Text-Item
http://ebiztechnics.blogspot.com
Summary
• Validation Unit
• Triggers and Built-ins for Validation.
– When-Validate-Item and When-Validate-Record
• Validation Properties
• Navigation in Forms
• Internal and External Navigation
• Navigational Triggers
– Pre- , Post- and When-New-”Object”-Instance Triggers
http://ebiztechnics.blogspot.com

Oracle Forms : Validation Triggers

  • 1.
    Validation & NavigationalTriggers http://ebiztechnics.blogspot.com
  • 2.
    Objectives • What isValidation Unit? • Form Builder Validation Properties • Using triggers to implement Validation • Navigation in Forms • Navigation Properties • Navigational Triggers • Built-ins used for Navigation http://ebiztechnics.blogspot.com
  • 3.
    Validation in FormBuilder • Form Builder provides the Validation at 4 Levels: Form Level Block Level Record Level Item Level http://ebiztechnics.blogspot.com
  • 4.
    Validation • Validation occurswhen: – Enter key is pressed or ENTER Built-in execute. – Operator or trigger leaves the validation unit (includes a Commit) http://ebiztechnics.blogspot.com
  • 5.
    Validation Property Form Module Properties-> Database-> Validation Unit http://ebiztechnics.blogspot.com
  • 6.
    Validate from list •Text item Property • Used to validate from LOV • If the input value does not exist in LOV the List of values window appears to choose. • Note: Do not use this property for large number of values. http://ebiztechnics.blogspot.com
  • 7.
    Validation Triggers • ItemLevel – When-Validate-Item • Block Level – When-Validate-Record IF :emp.ename is null or :emp.hiredate is null THEN message(‘Employee name or Joining Date can not be blank’); RAISE form_trigger_failure; END IF; http://ebiztechnics.blogspot.com
  • 8.
    Validating User Input •Salary Details Form. 7987Emp No When-Validate-Item SELECT ………. FROM emp WHERE empno=:empsal.empno; Trigger Failure http://ebiztechnics.blogspot.com
  • 9.
    Validation Status • NEW –When a record is created – Also for Copy Value from Item or Initial Value • CHANGED – When changed by user or trigger – When any item in new record is changed • VALID – When validation has been successful – After records are fetched from database – After a successful post or commit – Duplicated record inherits status of source http://ebiztechnics.blogspot.com
  • 10.
    Built-ins for Validation •CLEAR_BLOCK, CLEAR_ FORM, EXIT_FORM • ENTER • SET_FORM_PROPERTY – (..., VALIDATION) – (..., VALIDATION_UNIT) • ITEM_IS_VALID item property • VALIDATE (VALIDATION_ UNIT) SET_FORM_PROPERTY(‘FORM_MOD’,VALIDATION_UNIT, );ITEM_SCOPE RECORD_SCOPE / BLOCK_SCOPE / FORM_SCOPE http://ebiztechnics.blogspot.com
  • 11.
    Navigation in forms •What is Navigational Unit? • Navigation in – Form – Block – Record – Item • Entering and Leaving Objects • What happens if navigation fails? http://ebiztechnics.blogspot.com
  • 12.
    Navigation Properties • Formmodule – Mouse navigation limit – First navigation data block • Block – Navigation style – Previous navigation data block – Next navigation data block • Item – Enabled – Keyboard navigable – Mouse navigate – Previous navigation item – Next navigation item http://ebiztechnics.blogspot.com
  • 13.
    Navigation in Blocks Exititem Exit record Exit block Enter block Enter record Enter item http://ebiztechnics.blogspot.com
  • 14.
    Internal Navigation Exit item Exitrecord Enter record Enter item http://ebiztechnics.blogspot.com
  • 15.
    Navigational Triggers When-New-“object”-Instance Fire afternavigation Does fire when validation unit is higher than the trigger object Allow restricted and unrestricted built-ins Are not affected by failure Pre- and Post- Fire during navigation Does not fire if validation unit is higher than trigger object Allow unrestricted built-ins Handle failure by returning to initial object http://ebiztechnics.blogspot.com
  • 16.
    Pre- and Post-Triggers • Pre/Post-Form • Pre/Post-Block • Pre/Post-Record • Pre/Post-Text-Item http://ebiztechnics.blogspot.com
  • 17.
    Example Pre-Block Trigger IFGET_APPLICATION_PROPERTY(username)=‘SCOTT’ THEN SET_BLOCK_PROPERTY(‘EMP’,UPDATE_ALLOWED, Property_False); END IF; http://ebiztechnics.blogspot.com
  • 18.
    When-New-”object” Instance • When-New-Form-Instance •When-New-Block-Instance • When-New-Record-Instance • When-New-Item-Instance http://ebiztechnics.blogspot.com
  • 19.
    Examples SET_FORM_PROPERTY(‘EMPL’, VALIDATION_UNIT, RECORD_SCOPE); SET_BLOCK_PROPERTY(‘EMP’, QUERY_ALLOWED,PROPERTY_FALSE); READ_IMAGE_FILE(‘E_’||:emp.empno||’.bmp’,’BMP’, ’emp.emp_image); SET_ITEM_PROPERTY(:SYSTEM.cursor_item, visual_attribute, ‘vared’); http://ebiztechnics.blogspot.com
  • 20.
  • 21.
    Summary • Validation Unit •Triggers and Built-ins for Validation. – When-Validate-Item and When-Validate-Record • Validation Properties • Navigation in Forms • Internal and External Navigation • Navigational Triggers – Pre- , Post- and When-New-”Object”-Instance Triggers http://ebiztechnics.blogspot.com

Editor's Notes

  • #14 Note: The default setting for the Mouse Navigate property is Yes.
  • #21 Note: Be sure to code against navigation trigger failure.