oracle forms : validation triggers
TRANSCRIPT
![Page 1: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/1.jpg)
Validation & Navigational Triggers
http://ebiztechnics.blogspot.com
![Page 2: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/2.jpg)
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
![Page 3: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/3.jpg)
Validation in Form Builder
• Form Builder provides the Validation at 4 Levels:
Form Level
Block Level
Record Level Item Level
http://ebiztechnics.blogspot.com
![Page 4: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/4.jpg)
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
![Page 5: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/5.jpg)
Validation Property
Form ModuleProperties -> Database->Validation Unit
http://ebiztechnics.blogspot.com
![Page 6: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/6.jpg)
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
![Page 7: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/7.jpg)
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
![Page 8: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/8.jpg)
Validating User Input
• Salary Details Form.
7987Emp No When-Validate-Item
SELECT ……….FROM empWHERE empno=:empsal.empno;
Trigger Failure
http://ebiztechnics.blogspot.com
![Page 9: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/9.jpg)
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
![Page 10: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/10.jpg)
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
![Page 11: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/11.jpg)
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
![Page 12: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/12.jpg)
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
![Page 13: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/13.jpg)
Navigation in Blocks
Exit item
Exit record
Exit block
Enter block
Enter record
Enter item
http://ebiztechnics.blogspot.com
![Page 14: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/14.jpg)
Internal Navigation
Exit item
Exit record
Enter record
Enter item
http://ebiztechnics.blogspot.com
![Page 15: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/15.jpg)
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
![Page 16: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/16.jpg)
Pre- and Post- Triggers
• Pre/Post-Form • Pre/Post-Block • Pre/Post-Record• Pre/Post-Text-Item
http://ebiztechnics.blogspot.com
![Page 17: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/17.jpg)
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
![Page 18: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/18.jpg)
When-New-”object” Instance
• When-New-Form-Instance• When-New-Block-Instance• When-New-Record-Instance• When-New-Item-Instance
http://ebiztechnics.blogspot.com
![Page 19: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/19.jpg)
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
![Page 20: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/20.jpg)
Navigational Trap
Pre-Text-Item
Pre-Text-Item
Post-Text-Item
http://ebiztechnics.blogspot.com
![Page 21: Oracle Forms : Validation Triggers](https://reader033.vdocument.in/reader033/viewer/2022061606/589ca3e21a28abf4148b65bb/html5/thumbnails/21.jpg)
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