Oracle iDS Forms: Build Internet Applications I

Post on 12-Nov-2014

879 views 7 download

transcript

Oracle iDS Forms: Build Internet Applications IElectronic Presentation

40033GC11Production 1.1May 2001D32778

Copyright Oracle Corporation, 2000, 2001. All rights reserved.

This documentation contains proprietary information of Oracle Corporation. It is provided under a license agreement containing restrictions on use and disclosure and is also protected by copyright law. Reverse engineering of the software is prohibited. If this documentation is delivered to a U.S. Government Agency of the Department of Defense, then it is delivered with Restricted Rights and the following legend is applicable:

Restricted Rights Legend

Use, duplication or disclosure by the Government is subject to restrictions for commercial computer software and shall be deemed to be Restricted Rights software under Federal law, as set forth in subparagraph (c) (1) (ii) of DFARS 252.227-7013, Rights in Technical Data and Computer Software (October 1988).

This material or any portion of it may not be copied in any form or by any means without the express prior written permission of Oracle Corporation. Any other copying is a violation of copyright law and may result in civil and/or criminal penalties.

If this documentation is delivered to a U.S. Government Agency not within the Department of Defense, then it is delivered with “Restricted Rights,” as defined in FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).

The information in this document is subject to change without notice. If you find any problems in the documentation, please report them in writing to Education Products, Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores, CA 94065. Oracle Corporation does not warrant that this document is error-free.

Oracle is a registered trademark and Oracle Forms Developer, Oracle Forms Server, Oracle Reports Developer, Oracle Reports Server, and PL/SQL are trademarks or registered trademarks of Oracle Corporation.

All other products or company names are used for identification purposes only and may be trademarks of their respective owners.

AuthorEllen Gravina

Technical Contributorsand ReviewersDavid Ball

Soley Celik

Kathy Cunningham

Ken Goetz

Andrey Ivkin

Kenji Makita

Jayne Marlow

Ian Purvis

Bryan Roberts

Rie Saitoh

Raza Siddiqui

Kajornsak Sungchareon

Ted Witiuk

PublisherRodney HartzellDon Griffin (UK)

Copyright Oracle Corporation, 2000. All rights reserved.

IntroductionIntroduction

II--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Identify the course objectives• Identify the course content and structure

After completing this lesson, you should be able to do the following:• Identify the course objectives• Identify the course content and structure

II--33 Copyright Oracle Corporation, 2000. All rights reserved.

Release 6i CurriculumRelease 6i Curriculum

Oracle 9iAS Forms ServicesDeploy Internet Applications

Oracle iDS Reports :Build Internet Reports

Report Builder Library

Oracle iDS Forms:Build Internet Applications I

ILTCBT

Form Builder Library

Oracle iDS Forms: : Build Internet Applications II

Form Builder Library

Oracle 9iAS Reports Services:Deploy Internet Applications

5 days5 days

3 days3 days

5 days5 days

2 days2 days 1 day1 day

WBT

II--44 Copyright Oracle Corporation, 2000. All rights reserved.

Course ObjectivesCourse ObjectivesAfter completing this course, you should be able todo the following:• Describe the capabilities of Oracle Forms Developer• Create form modules including components for

database interaction and GUI controls• Display form modules in multiple windows and a variety

of layout styles• Implement triggers to:

– Enhance functionality– Communicate with users– Supplement validation, control navigation, and

modify default transaction processing• Reuse objects and code

After completing this course, you should be able todo the following:• Describe the capabilities of Oracle Forms Developer• Create form modules including components for

database interaction and GUI controls• Display form modules in multiple windows and a variety

of layout styles• Implement triggers to:

– Enhance functionality– Communicate with users– Supplement validation, control navigation, and

modify default transaction processing• Reuse objects and code

II--55 Copyright Oracle Corporation, 2000. All rights reserved.

Course ContentCourse Content

Day 1• Lesson 1 Course Introduction• Lesson 2 Running a Form Builder Application• Lesson 3 Working in the Form Builder

Environment• Lesson 4 Creating a Basic Form Module

Day 1• Lesson 1 Course Introduction• Lesson 2 Running a Form Builder Application• Lesson 3 Working in the Form Builder

Environment• Lesson 4 Creating a Basic Form Module

II--66 Copyright Oracle Corporation, 2000. All rights reserved.

Course ContentCourse Content

Day 2• Lesson 5 Working with Data Blocks and Frames• Lesson 6 Working with Text Items• Lesson 7 Creating LOVs and Editors• Lesson 8 Creating Additional Input Items

Day 2• Lesson 5 Working with Data Blocks and Frames• Lesson 6 Working with Text Items• Lesson 7 Creating LOVs and Editors• Lesson 8 Creating Additional Input Items

II--77 Copyright Oracle Corporation, 2000. All rights reserved.

Course ContentCourse Content

Day 3• Lesson 9 Creating Non-Input Items• Lesson 10 Creating Windows and Content

Canvases• Lesson 11 Working with Other Canvases• Lesson 12 Introduction to Triggers• Lesson 13 Producing Triggers• Lesson 14 Debugging Triggers

Day 3• Lesson 9 Creating Non-Input Items• Lesson 10 Creating Windows and Content

Canvases• Lesson 11 Working with Other Canvases• Lesson 12 Introduction to Triggers• Lesson 13 Producing Triggers• Lesson 14 Debugging Triggers

II--88 Copyright Oracle Corporation, 2000. All rights reserved.

Course ContentCourse Content

Day 4• Lesson 15 Adding Functionality to Items• Lesson 16 Runform Messages and Alerts• Lesson 17 Query Triggers• Lesson 18 Validation• Lesson 19 Navigation

Day 4• Lesson 15 Adding Functionality to Items• Lesson 16 Runform Messages and Alerts• Lesson 17 Query Triggers• Lesson 18 Validation• Lesson 19 Navigation

II--99 Copyright Oracle Corporation, 2000. All rights reserved.

Course ContentCourse Content

Day 5• Lesson 20 Transaction Processing• Lesson 21 Writing Flexible Code• Lesson 22 Sharing Objects and Code• Lesson 23 Introducing Multiple Form

Applications

Day 5• Lesson 20 Transaction Processing• Lesson 21 Writing Flexible Code• Lesson 22 Sharing Objects and Code• Lesson 23 Introducing Multiple Form

Applications

Copyright Oracle Corporation, 2000. All rights reserved.

Introduction to Oracle Forms Developer and Oracle Forms Services

Introduction to Oracle Forms Developer and Oracle Forms Services

11--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Describe Oracle Forms Developer and Oracle

Forms Services components• Describe the architecture of Oracle Forms

Services• Describe Form Builder components• Navigate around the builder interface• Customize the Oracle Forms Developer session• Describe the course application

After completing this lesson, you should be able to do the following:• Describe Oracle Forms Developer and Oracle

Forms Services components• Describe the architecture of Oracle Forms

Services• Describe Form Builder components• Navigate around the builder interface• Customize the Oracle Forms Developer session• Describe the course application

11--33 Copyright Oracle Corporation, 2000. All rights reserved.

Internet Computing SolutionsInternet Computing Solutions

Application Typeand Audience

Enterprise applications,Business developers

Java components,Component developers

ProductApproach

Repository-basedmodeling & generation,

Declarative

OracleProducts

Oracle Designer,Oracle Forms Developer, &

Oracle Forms Services

Two-way coding,Java and JavaBeans

Oracle JDeveloper Oracle9i Application Server

Browser-based,Dynamic HTML

Self-service applications &content management,Web site developers

Oracle PortalOracle Database Server

Dynamic Web reporting, Drill, slice & dice, Forecasting

Reporting and analytical applications,MIS & business users

Oracle Reports Developer,Oracle Reports Services,

Oracle Discoverer, &Oracle Express

11--44 Copyright Oracle Corporation, 2000. All rights reserved.

Oracle Internet PlatformOracle Internet Platform

InternetDeveloperSuite

11--55 Copyright Oracle Corporation, 2000. All rights reserved.

What Is Oracle Forms Developer?What Is Oracle Forms Developer?

A productive development environment for Internet business applications

– Data entry – Query screens

A productive development environment for Internet business applications

– Data entry – Query screens

11--66 Copyright Oracle Corporation, 2000. All rights reserved.

What Is Oracle Forms Services?What Is Oracle Forms Services?

A component of Oracle9i Application Server thatdeploys Forms applications to Java clients in a Webenvironment

A component of Oracle9i Application Server thatdeploys Forms applications to Java clients in a Webenvironment

Oracle Forms Services

Oracle HTTP Server

11--77 Copyright Oracle Corporation, 2000. All rights reserved.

9iAS Major Elements9iAS Major Elements

Oracle8i

Oracle8iJVM

Oracle8iCache

Enterprise Manager, Internet Directory

Discoverer

OracleHTTPServer

PoweredBy

Apache

Communication Services

PresentationServices

Business LogicServices

Data MgmtServices

System Services

Oracle JSP

Portal

Oracle8iPL/SQL

BC4JRuntime

Oracle PSP

Apache JServ

PerlInterpreter

iFS(eMail,

Network)

Reports

Forms

11--88 Copyright Oracle Corporation, 2000. All rights reserved.

JavaJavaformsforms

Oracle HTTP ServerOracle HTTP Server

Oracle8Oracle8iior other databaseor other database

FormsServices

Oracle Forms Services ArchitectureOracle Forms Services Architecture

11--99 Copyright Oracle Corporation, 2000. All rights reserved.

Forms ServicesForms Services

JRE

Applicationlogic layer

Data manager/PL/SQL engine

User interface layer

Forms Listener

Forms CGI or Servlet

Forms Runtime

Client TierClient Tier Database TierDatabase TierMiddle Tier:Middle Tier:

Application ServerApplication Server

Incrementallydownloaded

FMX file

User interfacelayer

User interfacelayer

User interfacelayer

User interfacelayer

User interfacelayer

User interfacelayer

User interfacelayer

User interfacelayerUser interface

layerUser interfacelayerUser interface

layerUser interfacelayerUser interface

layerUser interfacelayerUser interfacelayerUser interfacelayerUser interfacelayerUser interfacelayerUser interfacelayer

SQL*Net

Java applet

DB

11--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Key FeaturesKey Features

• Comprehensive GUI support• Distributed applications• Tools for rapid application development• Application partitioning• Flexible source control• Extended scalability• Object reuse

• Comprehensive GUI support• Distributed applications• Tools for rapid application development• Application partitioning• Flexible source control• Extended scalability• Object reuse

11--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Form Builder ComponentsForm Builder Components

11--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Form Builder Layout EditorForm Builder Layout Editor

ToolbarToolbar

Tool PaletteTool Palette

11--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Oracle Toolkit and MultimediaOracle Toolkit and Multimedia

ApplicationsForms

OSF/MotifOSF/Motif

MicrosoftMicrosoftWindows 95Windows 95Windows NTWindows NT

CharacterCharactermodemode

12

3

4

11--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Getting StartedGetting Started

• Start Form Builder.• See the Welcome page with several options.• Connect to the database.• Select File—>Connect.

• Start Form Builder.• See the Welcome page with several options.• Connect to the database.• Select File——>>Connect.

11--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Main Menu StructureMain Menu Structure

11--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Customizing Your Oracle Developer Session

Customizing Your Oracle Developer Session

11--1717 Copyright Oracle Corporation, 2000. All rights reserved.

Saving Tools PreferencesSaving Tools Preferences

1 2

3

11--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Oracle Forms DeveloperEnvironment Variables

Oracle Forms DeveloperEnvironment Variables

• FORMS60_PATH• UI_ICON• ORACLE_PATHWindows NT: Modify in Registry (REGEDIT.EXE or REGEDT32.EXE)

• FORMS60_PATH• UI_ICON• ORACLE_PATHWindows NT: Modify in Registry (REGEDIT.EXE or REGEDT32.EXE)

11--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Environment Variables and Y2K Compliance

Environment Variables and Y2K Compliance

• NLS_DATE_FORMAT• FORMS60_USER_DATE_FORMAT• NLS_DATE_FORMAT• FORMS60_USER_DATE_FORMAT

11--2020 Copyright Oracle Corporation, 2000. All rights reserved.

Using the Online Help SystemUsing the Online Help System

• Quick Tour: Built-in CBT package of technical information

• Cue Cards: Simple step-by-step instructions

• Quick Tour: Built-in CBT package of technical information

• Cue Cards: Simple step-by-step instructions

11--2121 Copyright Oracle Corporation, 2000. All rights reserved.

Summit Sporting Goods SchemaSummit Sporting Goods Schema

s_item s_ord s_customer

s_emps_inventory

s_product s_warehouse s_dept

s_image s_region

11--2222 Copyright Oracle Corporation, 2000. All rights reserved.

Summit ApplicationSummit Application

CV_Customer Canvas

S_CUSTOMER Block

CV_Order Canvas

S_ORD Block

S_ITEM BlockCV_Inventory Canvas

S_Inventory Block

S_INVENTORYTable

S_CUSTOMERTable

S_ORDTable

S_ITEMTable

CustomersCustomersFormForm

OrdersOrdersFormForm

11--2323 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Oracle Forms Developer features• Oracle Forms Services components• Builder interface• Builder preferences• The Summit course application

• Oracle Forms Developer features• Oracle Forms Services components• Builder interface• Builder preferences• The Summit course application

11--2424 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 1 OverviewPractice 1 Overview

This practice covers the following topics:• Becoming familiar with the Object Navigator and

Layout Editor• Modifying file access preferences

This practice covers the following topics:• Becoming familiar with the Object Navigator and

Layout Editor• Modifying file access preferences

Copyright Oracle Corporation, 2000. All rights reserved.

Running a Form Builder Application

Running a Form Builder Application

22--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Describe application deployment environments• Describe the run-time environment• Navigate a Form Builder application• Describe the two modes of operation• Retrieve both restricted and unrestricted data• Insert, update, and delete records• Display database errors

After completing this lesson, you should be able to do the following:• Describe application deployment environments• Describe the run-time environment• Navigate a Form Builder application• Describe the two modes of operation• Retrieve both restricted and unrestricted data• Insert, update, and delete records• Display database errors

22--33 Copyright Oracle Corporation, 2000. All rights reserved.

• Oracle Forms Services Web deployment

• Oracle Forms Developer client-server environment

• Oracle Forms Services Web deployment

• Oracle Forms Developer client-server environment

Application DeploymentApplication Deployment

22--44 Copyright Oracle Corporation, 2000. All rights reserved.

Web Form TesterWeb Form Tester

22--55 Copyright Oracle Corporation, 2000. All rights reserved.

Web Deployment: Run-Time ComponentsWeb Deployment: Run-Time Components

5

13 4

2

22--66 Copyright Oracle Corporation, 2000. All rights reserved.

Client-Server Run-Time ComponentsClient-Server Run-Time Components

4

1

23

22--77 Copyright Oracle Corporation, 2000. All rights reserved.

Client-Server Run-Time ComponentsClient-Server Run-Time Components

4

1

23

22--88 Copyright Oracle Corporation, 2000. All rights reserved.

Data ElementsData Elements

1 2 3 4

5

7 6

98

22--99 Copyright Oracle Corporation, 2000. All rights reserved.

Navigating at Run TimeNavigating at Run Time

• Default menu• Menu toolbar• Mouse• Buttons• Function keys

• Default menu• Menu toolbar• Mouse• Buttons• Function keys

22--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Navigating at Run TimeNavigating at Run Time

• Default menu• Menu toolbar• Mouse• Buttons• Function keys

• Default menu• Menu toolbar• Mouse• Buttons• Function keys

22--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Allows:• Unrestricted and

restricted queries• Record count by using

Query—>Count Hits

Allows:• Unrestricted and

restricted queries• Record count by using

Query——>>Count Hits

Enter Query ModeEnter Query Mode

Does not allow:• Navigation out of

current data block• Exiting run-time session• Certain functions• Insert, update, delete

Does not allow:• Navigation out of

current data block• Exiting run-time session• Certain functions• Insert, update, delete

22--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Normal ModeNormal Mode

Allows:• Unrestricted queries• Insert, update, delete• Commit (Save)• Navigation out of

current data block• Exiting run-time session

Allows:• Unrestricted queries• Insert, update, delete• Commit (Save)• Navigation out of

current data block• Exiting run-time session

Does Not Allow:• Restricted queries• Query/Where dialog box

Does Not Allow:• Restricted queries• Query/Where dialog box

22--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Retrieving DataRetrieving Data

A B C D1234

A B C D34

Unrestricted queryUnrestricted query Restricted queryRestricted query

A B C D1

34

2

A B C D1234

22--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Retrieving Restricted DataRetrieving Restricted Data

• Do not use quotation marks with character and date items.

• The LIKE operator is implied with % or _.• Use hash (#) in front of SQL operators.• Use Query/Where for complex query conditions.• Use default date format (DD-MON-YY) in

Query/Where.• Use quotes around literals in Query/Where.

• Do not use quotation marks with character and date items.

• The LIKE operator is implied with % or _.• Use hash (#) in front of SQL operators.• Use Query/Where for complex query conditions.• Use default date format (DD-MON-YY) in

Query/Where.• Use quotes around literals in Query/Where.

22--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Query/Where Dialog BoxQuery/Where Dialog Box

• Invoke by:– Entering :variable_name– Executing query

• Used to write:– Complex search conditions– Queries with OR predicates– ORDER BY clause

• Invoke by:– Entering :variable_name– Executing query

• Used to write:– Complex search conditions– Queries with OR predicates– ORDER BY clause

22--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Query/Where Dialog BoxQuery/Where Dialog Box

22--1717 Copyright Oracle Corporation, 2000. All rights reserved.

Making Changes PermanentMaking Changes Permanent

Form moduleForm moduleORDERS

Order

Item

Action

Save

FORMS RUNTIME

DeletesDeletes

UpdatesUpdates

InsertsInserts

MemoryMemory

oror

22--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Making Permanent ChangesMaking Permanent Changes

• Select Action—>Save to make changes permanent.

• Select Action—>Clear All to discard changes.

• Select Action——>Save to make changes permanent.

• Select Action—>Clear All to discard changes.

22--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Display ErrorDisplay Error

• Use to view Oracle errors• Select Help—>Display Error• Shows:

– SQL statement in error– Error information

• Use to view Oracle errors• Select Help—>Display Error• Shows:

– SQL statement in error– Error information

22--2020 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• The run-time environment for forms deployed on the Web

• The run-time environment for forms deployed in a client-server environment

• Data elements• Navigation methods• Modes of operation:

– Normal mode– Enter Query mode

• The run-time environment for forms deployed on the Web

• The run-time environment for forms deployed in a client-server environment

• Data elements• Navigation methods• Modes of operation:

– Normal mode– Enter Query mode

22--2121 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Retrieving data:– Restricted queries– Unrestricted queries

• Inserting, updating, and deleting data• Displaying errors

• Retrieving data:– Restricted queries– Unrestricted queries

• Inserting, updating, and deleting data• Displaying errors

22--2222 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 2 OverviewPractice 2 Overview

This practice covers the following topics:• Running a form application on the Web and in a

client-server environment• Executing unrestricted and restricted queries• Performing inserts, updates, and deletes in a form

application• Saving changes to the database

This practice covers the following topics:• Running a form application on the Web and in a

client-server environment• Executing unrestricted and restricted queries• Performing inserts, updates, and deletes in a form

application• Saving changes to the database

Copyright Oracle Corporation, 2000. All rights reserved.

Working in the Form Builder EnvironmentWorking in the Form Builder Environment

33--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Identify the main Form Builder executables• Identify the main components of Form Builder• Identify the main objects in a form module

After completing this lesson, you should be able to do the following:• Identify the main Form Builder executables• Identify the main components of Form Builder• Identify the main objects in a form module

33--33 Copyright Oracle Corporation, 2000. All rights reserved.

Form Builder Key FeaturesForm Builder Key Features

With Form Builder you can: • Insert, update, delete, and query data• Present data as text, sound, video, image, and

ActiveX controls• Control forms across several windows and

database transactions• Access Graphics and OLE2 applications• Use integrated menus• Send data to Oracle Reports Builder

With Form Builder you can: • Insert, update, delete, and query data• Present data as text, sound, video, image, and

ActiveX controls• Control forms across several windows and

database transactions• Access Graphics and OLE2 applications• Use integrated menus• Send data to Oracle Reports Builder

33--44 Copyright Oracle Corporation, 2000. All rights reserved.

Form Builder ExecutablesForm Builder Executables

Form Builder

Form Compiler FormsRuntime

DefinitionsDefinitions

Run filesRun files

33--55 Copyright Oracle Corporation, 2000. All rights reserved.

Form Builder Module TypesForm Builder Module Types

PL/SQLLibrary

ObjectLibrary

Menus Forms

Oracle Forms Developercomponents,

Oracle Reports DeveloperACTIVEX

DDEOLE2

OtherOther

Data sourcesData sources DatabaseDatabase

Libraries

33--66 Copyright Oracle Corporation, 2000. All rights reserved.

Blocks, Items, and CanvasesBlocks, Items, and Canvases

Canvas 1Canvas 1 Canvas 2Canvas 2

ItemsItems

Block ABlock ABlock BBlock B

33--77 Copyright Oracle Corporation, 2000. All rights reserved.

Navigation in a BlockNavigation in a Block

Canvas 1Canvas 1 Canvas 2Canvas 2

33--88 Copyright Oracle Corporation, 2000. All rights reserved.

Data BlocksData Blocks

A B C

A B C

Master Data Block

D

X Y Z

Detail Data BlockX Y Z

TableTable

TableTable

43

6

5

2

1

33--99 Copyright Oracle Corporation, 2000. All rights reserved.

Data BlocksData Blocks

A B C

A B C

Master Data Block

D

X Y Z

Detail Data BlockX Y Z

TableTable

TableTable

43

6

5

2

1

33--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Forms and Data BlocksForms and Data Blocks

Block 1

Block 2

Block 3

Block 4

Block 1

Block 2

Block 1

Block 1

Single FormSingle FormModuleModule

Multiple Form ModulesMultiple Form Modules

Form AForm A Form BForm B

OpenOpenFormForm

Open FormOpen Form

Form CForm C

33--1111 Copyright Oracle Corporation, 2000. All rights reserved.

ColumnColumn

Canvas

TriggerTrigger

Item

Item

Item

Frame

Window

TableTable

DatabaseDatabase

Form Module HierarchyForm Module Hierarchy

Module DatabaseDatabase

TableTable

Block(s)BlocksColumn

ItemItemItem

FrameCanvas

Window

TriggerTrigger

Program UnitsProgram units

TriggerTrigger

33--1212 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Form Builder allows screen-based querying, inserting, updating, and deleting of data.

• Form Builder has powerful GUI and integration features.

• Applications can consist of form modules, menu modules, and library documents.

• Form Builder allows screen-based querying, inserting, updating, and deleting of data.

• Form Builder has powerful GUI and integration features.

• Applications can consist of form modules, menu modules, and library documents.

33--1313 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Form modules consist of logical data blocks, which are logical owners of items.

• Items in a data block can span several canvases.

• Form modules consist of logical data blocks, which are logical owners of items.

• Items in a data block can span several canvases.

Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Basic Form ModuleCreating a Basic Form Module

44--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Create a form module• Create a data block• Modify a data block by using the Data Block

Wizard• Modify the layout by using the Layout Wizard• Save, compile, and run a form module• Identify file formats and their characteristics• Create data blocks with relationships• Run a master-detail form module

After completing this lesson, you should be able to do the following:• Create a form module• Create a data block• Modify a data block by using the Data Block

Wizard• Modify the layout by using the Layout Wizard• Save, compile, and run a form module• Identify file formats and their characteristics• Create data blocks with relationships• Run a master-detail form module

44--33 Copyright Oracle Corporation, 2000. All rights reserved.

Create data blocks and items

Apply standards

Fine-tune layout

Set object properties

Add code

Creating a New Form ModuleCreating a New Form Module

Test form module

Create an empty module

44--44 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a New Form ModuleCreating a New Form Module

Choose one of several methods:• Use wizards:

– Data Block Wizard– Layout Wizard

• Build module manually• Use template form

Choose one of several methods:• Use wizards:

– Data Block Wizard– Layout Wizard

• Build module manually• Use template form

44--55 Copyright Oracle Corporation, 2000. All rights reserved.

Form Module PropertiesForm Module Properties

Nameproperty

CoordinateSystemproperty

44--66 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a New Data BlockCreating a New Data Block

Use Form Builder Wizards:• Data Block Wizard: Create a data block with

associated data source quickly and easily• Layout Wizard: Lay out data block contents for

visual presentation• Create manually

Use Form Builder Wizards:• Data Block Wizard: Create a data block with

associated data source quickly and easily• Layout Wizard: Lay out data block contents for

visual presentation• Create manually

44--77 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a New Data BlockCreating a New Data Block

Launch DataBlock Wizard

Enter datasource

Launch LayoutWizard

Lay out datablock contents

New Data BlockNew Data Block

Reentrant modeReentrant mode

Reentrant modeReentrant mode

44--88 Copyright Oracle Corporation, 2000. All rights reserved.

Navigating the WizardsNavigating the Wizards

44--99 Copyright Oracle Corporation, 2000. All rights reserved.

Launching the Data Block Wizard

Launching the Data Block Wizard

In Form Builder, do one of the following:• Select Tools—>Data Block Wizard.• Click the right mouse button.

Use the Data Block Wizard option.• Select the Data Blocks node and then click the

Create icon in Object Navigator.Use the Data Block Wizard option.

• Use the Data Block Wizard button on the toolbar in the Layout Editor

In Form Builder, do one of the following:• Select Tools—>Data Block Wizard.• Click the right mouse button.

Use the Data Block Wizard option.• Select the Data Blocks node and then click the

Create icon in Object Navigator.Use the Data Block Wizard option.

• Use the Data Block Wizard button on the toolbar in the Layout Editor

44--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Data Block Wizard: Type PageData Block Wizard: : Type Page

44--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Data Block Wizard: Table PageData Block Wizard: : Table Page

44--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Layout Wizard: Items PageLayout Wizard: : Items Page

44--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Layout Wizard: Style PageLayout Wizard: : Style Page

44--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Layout Wizard: Rows PageLayout Wizard: : Rows Page

44--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Data Block FunctionalityData Block Functionality

Once you create a data block with the wizards, Form Builder automatically creates:• A form module with database functionality

including query, insert, update, delete• A frame object• Items in the data block• A prompt for each item

Once you create a data block with the wizards, Form Builder automatically creates:• A form module with database functionality

including query, insert, update, delete• A frame object• Items in the data block• A prompt for each item

44--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Modifying the LayoutModifying the Layout

• Reentrant Layout Wizard:– Select frame in Object Navigator.– Select Tools—>Layout Wizard.or

– Select frame in Layout Editor.– Click Layout Wizard button.

• Layout Editor:– Select Tools—>Layout Editor.– Make changes manually.

• Frame Property Palette: Change property values.

• Reentrant Layout Wizard:– Select frame in Object Navigator.– Select Tools—>Layout Wizard.or

– Select frame in Layout Editor.– Click Layout Wizard button.

• Layout Editor:– Select Tools—>Layout Editor.– Make changes manually.

• Frame Property Palette: Change property values.

44--1717 Copyright Oracle Corporation, 2000. All rights reserved.

Template FormTemplate Form

44--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Saving a Form ModuleSaving a Form Module

• Save the form module:– Select File—>Save.– Click the Save icon.

• Enter a filename.• Save to one of the following:

– File system– Database

• Save the form module:– Select File—>Save.– Click the Save icon.

• Enter a filename.• Save to one of the following:

– File system– Database

44--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Compiling a Form ModuleCompiling a Form Module

• Compile explicitly:– Select File—>Administration—>Compile File.– Launch the Form Compiler component.– Initiate from Command line interface.

• Compile implicitly:– Select Tools—>Preferences.– Set the Build Before Running preference.

• Compile explicitly:– Select File—>Administration—>Compile File.– Launch the Form Compiler component.– Initiate from Command line interface.

• Compile implicitly:– Select Tools—>Preferences.– Set the Build Before Running preference.

44--2020 Copyright Oracle Corporation, 2000. All rights reserved.

Running a Form ModuleRunning a Form Module

• Web browser• Forms Runtime component• Command line interface• Form Builder component

– Select Program—>Run Form and then select the desired option.

– Click one of the Run icons.

• Web browser• Forms Runtime component• Command line interface• Form Builder component

– Select Program—>Run Form and then select the desired option.

– Click one of the Run icons.

44--2121 Copyright Oracle Corporation, 2000. All rights reserved.

Running a Form Module on the WebRunning a Form Module on the Web

• Create an HTML file.

• View the URL in a browser.

• Create an HTML file.

• View the URL in a browser.

<EMBED type="application/x-jinit-applet"

CODE="oracle.forms.engine.Main"

CODEBASE="/web_frms/"

ARCHIVE="f60all.jar"

WIDTH=750 HEIGHT=400

serverPort="5555"

serverArgs="module=customers.fmxuserid=scott/tiger@mydatabase"

serverApp="/web_html/summit"

pluginspage="http://mymachine/jinit_download.htm">

<NOEMBED>

</NOEMBED></EMBED>

44--2222 Copyright Oracle Corporation, 2000. All rights reserved.

Text Files and DocumentationText Files and Documentation

• Convert a binary file to a text file.• Create an ASCII file for a form module.• Convert a binary file to a text file.• Create an ASCII file for a form module.

44--2323 Copyright Oracle Corporation, 2000. All rights reserved.

Module TypesModule Types

.fmb .fmx .fmtForm Module

.mmb .mmx .mmtMenuModule

.pll .plx .pldPL/SQLLibrary

.olb .oltObjectLibrary

44--2424 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 4-1 OverviewPractice 4-1 Overview

This practice covers the following topics:• Creating a new form module• Creating a data block by using Form Builder

wizards• Saving and running the form module

This practice covers the following topics:• Creating a new form module• Creating a data block by using Form Builder

wizards• Saving and running the form module

44--2525 Copyright Oracle Corporation, 2000. All rights reserved.

Form Block RelationshipsForm Block Relationships

Master

Detail

Master

Detail

Detail

Master

Detail Detail

44--2626 Copyright Oracle Corporation, 2000. All rights reserved.

Data Block Wizard: Master-Detail PageData Block Wizard: Master-Detail Page

44--2727 Copyright Oracle Corporation, 2000. All rights reserved.

Relation ObjectRelation Object

• New relation object created in Object Navigator under master data block node

• Default name assigned:MasterDataBlock_DetailDataBlock

• Triggers and program units generated automatically

• New relation object created in Object Navigator under master data block node

• Default name assigned:MasterDataBlock_DetailDataBlock

• Triggers and program units generated automatically

44--2828 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Relation ManuallyCreating a Relation Manually

44--2929 Copyright Oracle Corporation, 2000. All rights reserved.

Deletion PropertiesDeletion Properties

IsolatedIsolated

CascadingCascading

NonisolatedNonisolatedNo Detail RecNo Detail Rec

NonisolatedNonisolatedDetail RecDetail Rec

= Deleted= Deleted

MasterMaster--DetailDetailRecordsRecords

44--3030 Copyright Oracle Corporation, 2000. All rights reserved.

Coordination PropertiesCoordination Properties

DefaultDefault DeferredDeferredwith autowith auto

queryquery

DeferredDeferredwithoutwithout

auto queryauto query

44--3131 Copyright Oracle Corporation, 2000. All rights reserved.

Join ConditionJoin Condition

• Creates primary-foreign key link between blocks• Define using:

– Block and item names– SQL equijoin syntax

• Creates primary-foreign key link between blocks• Define using:

– Block and item names– SQL equijoin syntax

44--3232 Copyright Oracle Corporation, 2000. All rights reserved.

Running a Master-Detail Form ModuleRunning a Master-Detail Form Module

• Automatic block linking for:– Querying– Inserting

• Default deletion rules: Cannot delete master record if detail records exist

• Automatic block linking for:– Querying– Inserting

• Default deletion rules: Cannot delete master record if detail records exist

44--3333 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Build a new form module: – Using Form Builder wizards – Manually– Using a template form

• Use the Data Block Wizard—data source.• Use the Layout Wizard—visual presentation.

• Build a new form module: – Using Form Builder wizards – Manually– Using a template form

• Use the Data Block Wizard—data source.• Use the Layout Wizard—visual presentation.

44--3434 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Modify layout—reentrant wizards.• Save, compile, and run a form module.• Use module types and storage formats.• Create master-detail form module.

• Modify layout—reentrant wizards.• Save, compile, and run a form module.• Use module types and storage formats.• Create master-detail form module.

44--3535 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 4-2 OverviewPractice 4-2 Overview

This practice covers the following topics:• Creating a master-detail form module • Modifying data block layout by using the Layout

Wizard in reentrant mode• Saving and running the form module

This practice covers the following topics:• Creating a master-detail form module • Modifying data block layout by using the Layout

Wizard in reentrant mode• Saving and running the form module

Copyright Oracle Corporation, 2000. All rights reserved.

Working with Data Blocks and FramesWorking with Data Blocks and Frames

55--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Identify the components of the Property Palette• Manipulate properties through the Property Palette• Control the behavior and appearance of data

blocks

After completing this lesson, you should be able to do the following:• Identify the components of the Property Palette• Manipulate properties through the Property Palette• Control the behavior and appearance of data

blocks

55--33 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

• Control frame properties• Create blocks that do not directly correspond to

the database• Delete data blocks and their components

• Control frame properties• Create blocks that do not directly correspond to

the database• Delete data blocks and their components

55--44 Copyright Oracle Corporation, 2000. All rights reserved.

Modifying the Appearance and Behavior of Data Blocks

Modifying the Appearance and Behavior of Data Blocks

• Reentrant wizards• Layout Editor• Data Block Property Palette• Frame Property Palette

• Reentrant wizards• Layout Editor• Data Block Property Palette• Frame Property Palette

55--55 Copyright Oracle Corporation, 2000. All rights reserved.

Displaying the Property PaletteDisplaying the Property Palette

Use one of several methods:• Select Tools—>Property Palette.• Double-click the object icon in the Object

Navigator.• Double-click the object in Layout Editor.• Click the right mouse button.

Use one of several methods:• Select Tools—>Property Palette.• Double-click the object icon in the Object

Navigator.• Double-click the object in Layout Editor.• Click the right mouse button.

55--66 Copyright Oracle Corporation, 2000. All rights reserved.

Property Palette FeaturesProperty Palette Features

PropertyPropertynamename

PropertyPropertyvaluevalue

ToolbarToolbar

Expand/Expand/CollapseCollapse

Find fieldFind field

SearchSearchBackwardBackwardSearchSearchForwardForward

55--77 Copyright Oracle Corporation, 2000. All rights reserved.

Property ControlsProperty Controls

• Text field• Pop-up list• LOV window• More button

• Text field• Pop-up list• LOV window• More button

55--88 Copyright Oracle Corporation, 2000. All rights reserved.

Visual AttributesVisual Attributes

• Visual attributes: – Are font, color, and pattern properties– Can be set for form and menu objects

• A visual attribute is a form object with font, color, and pattern properties.

• Set the Visual Attribute Group property to the visual attribute object.

• Visual attributes: – Are font, color, and pattern properties– Can be set for form and menu objects

• A visual attribute is a form object with font, color, and pattern properties.

• Set the Visual Attribute Group property to the visual attribute object.

55--99 Copyright Oracle Corporation, 2000. All rights reserved.

Font, Pattern, and Color PickerFont, Pattern, and Color Picker

55--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Data Block PropertiesData Block Properties

55--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Data Block Property GroupsData Block Property Groups

• General• Navigation• Records• Database• Advanced Database• Scrollbar• Font and Color• Character Mode• International

• General• Navigation• Records• Database• Advanced Database• Scrollbar• Font and Color• Character Mode• International

55--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Navigation PropertiesNavigation Properties

ORDERSOrder

ItemSameRecordNextRecord

Previous NavigationData Block

Next NavigationData Block

55--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Database PropertiesDatabase Properties

Use properties in the Database group to control:• Type of block—data or control block• Query, insert, update, and delete operations on the

data block• Data block’s data source• Query search criteria and default sort order• Maximum query time• Maximum number of records fetched

Use properties in the Database group to control:• Type of block—data or control block• Query, insert, update, and delete operations on the

data block• Data block’s data source• Query search criteria and default sort order• Maximum query time• Maximum number of records fetched

55--1414 Copyright Oracle Corporation, 2000. All rights reserved.

SELECT ....

WHERE Clause

[ORDER BY Clause]

Database PropertiesDatabase Properties

Work fileWork file

Block displayBlock display

RecordsRecordsfetchedfetched

Records bufferedRecords buffered

55--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Records PropertiesRecords Properties

Vertical Record OrientationVertical Record Orientation

Horizontal Record OrientationHorizontal Record Orientation

55--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Records PropertiesRecords Properties

Item

Number

of Records

Displayed

Current Record

55--1717 Copyright Oracle Corporation, 2000. All rights reserved.

Scroll Bar PropertiesScroll Bar Properties

Item Scroll Bar X/YPosition

Scroll Bar Width

ScrollBarHeight

55--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Frame PropertiesFrame PropertiesORDERS

Order

Item

FormLayoutStyle

TabularLayoutStyle

Distancebetweenrecords

55--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Multiple Property PalettesMultiple Property Palettes

• Display multiple Property Palettes for an object: 1 Open a Property Palette for the object.2 Hold down the [Shift] key and double-click the

object icon for an additional palette. • Display Property Palettes for multiple objects:

1 Open the Property Palette for first object.2 Click the Freeze/Unfreeze button on the

toolbar.3 Invoke Property Palette for the next object.

• Display multiple Property Palettes for an object: 1 Open a Property Palette for the object.2 Hold down the [Shift] key and double-click the

object icon for an additional palette. • Display Property Palettes for multiple objects:

1 Open the Property Palette for first object.2 Click the Freeze/Unfreeze button on the

toolbar.3 Invoke Property Palette for the next object.

55--2020 Copyright Oracle Corporation, 2000. All rights reserved.

Setting Properties on Multiple ObjectsSetting Properties on Multiple Objects

Intersection/Union

55--2121 Copyright Oracle Corporation, 2000. All rights reserved.

Copying PropertiesCopying PropertiesCopyCopy PastePaste

Source objectsSource objects Destination objectsDestination objects

PropertiesProperties

Name S_ITEMName S_ITEMQuery All Records NoQuery Allowed YesInsert Allowed YesUpdate Allowed YesDelete Allowed Yes

Query All Records YesQuery Allowed YesInsert Allowed YesUpdate Allowed NoDelete Allowed Yes

55--2222 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Control BlockCreating a Control Block

• Click the Data Blocks node and click the Create icon. or Select Navigator—>Create.

• Select the “Build a new data block manually” option in the New Data Block dialog box.

• Click the Data Blocks node and click the Create icon. or Select Navigator—>Create.

• Select the “Build a new data block manually” option in the New Data Block dialog box.

55--2323 Copyright Oracle Corporation, 2000. All rights reserved.

Deleting a Data BlockDeleting a Data Block

• Select a data block for deletion and click the Delete icon. or Select Navigator—>Delete.

• Click Yes in the alert box.

• Select a data block for deletion and click the Delete icon. or Select Navigator—>Delete.

• Click Yes in the alert box.

55--2424 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Modify the data block properties in its Property Palette to change its behavior.

• Data blocks have Navigation, Database, Records, Scrollbar, and other properties.

• Database properties include WHERE Clause, Query Data Source, and Maximum Records Fetched.

• Change frame properties to modify the arrangements of items within a data block.

• Modify the data block properties in its Property Palette to change its behavior.

• Data blocks have Navigation, Database, Records, Scrollbar, and other properties.

• Database properties include WHERE Clause, Query Data Source, and Maximum Records Fetched.

• Change frame properties to modify the arrangements of items within a data block.

55--2525 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• A control block is not associated with the database.

• Copy properties between data blocks and other objects.

• View and change properties of several objects together (Intersection/Union).

• A control block is not associated with the database.

• Copy properties between data blocks and other objects.

• View and change properties of several objects together (Intersection/Union).

55--2626 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 5 OverviewPractice 5 Overview

This practice covers the following topics:• Creating a control block• Creating a visual attribute• Modifying data block properties• Modifying frame properties

This practice covers the following topics:• Creating a control block• Creating a visual attribute• Modifying data block properties• Modifying frame properties

Copyright Oracle Corporation, 2000. All rights reserved.

Working with Text ItemsWorking with Text Items

66--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following :• Describe text items• Create a text item• Modify the appearance of a text item• Control the data in a text item

After completing this lesson, you should be able to do the following :• Describe text items• Create a text item• Modify the appearance of a text item• Control the data in a text item

66--33 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

• Modify the navigational behavior of a text item• Enhance the relationship between the text item

and the database• Modify the functionality of a text item• Include Help messages

• Modify the navigational behavior of a text item• Enhance the relationship between the text item

and the database• Modify the functionality of a text item• Include Help messages

66--44 Copyright Oracle Corporation, 2000. All rights reserved.

Text ItemsText Items

• Default item type• Interface object for:

– Querying– Inserting– Updating– Deleting

• Behavior defined in the Property Palette

• Default item type• Interface object for:

– Querying– Inserting– Updating– Deleting

• Behavior defined in the Property Palette

66--55 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Text ItemCreating a Text ItemCanvas selectionCanvas selection Block selectionBlock selection

66--66 Copyright Oracle Corporation, 2000. All rights reserved.

Modifying the Appearance of a Text ItemModifying the Appearance of a Text Item

Order

Item

Distancebetweenrecords

Numberof itemsdisplayed

66--77 Copyright Oracle Corporation, 2000. All rights reserved.

Font and Color PropertiesFont and Color Properties

Use properties in the Font and Color group to specifyan item’s:• Visual attributes• Font name, size, weight, style, color, and pattern

Use properties in the Font and Color group to specifyan item’s:• Visual attributes• Font name, size, weight, style, color, and pattern

66--88 Copyright Oracle Corporation, 2000. All rights reserved.

PromptsPrompts

• Prompts specify the text label that is associated with an item.

• Several properties are available to arrange and manage prompts.

• Use prompt properties of an item to change the prompt’s display style, justification, alignment, color, and font.

• Prompts specify the text label that is associated with an item.

• Several properties are available to arrange and manage prompts.

• Use prompt properties of an item to change the prompt’s display style, justification, alignment, color, and font.

66--99 Copyright Oracle Corporation, 2000. All rights reserved.

Associating Text with an Item PromptAssociating Text with an Item Prompt

1

2

3

66--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Synchronize with Item PropertySynchronize with Item Property

1 2

66--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Copy Value from Item PropertyCopy Value from Item Property

ORDERS

Sales

Dept1Region Id

Name

Id Last Name First Name Title Dept Id3 Nagayama Midori VP, Sales 3111 Magee Colin Sales Rep 31

Employee

31Id

66--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Format MasksFormat Masks

• Standard SQL formats– Dates FXDD-MON-YY– Numbers L099G99D99

• Nonstandard formatsUse double quotes for embedded characters"("099")"099"-"0999

Note: Allow for format mask’s embedded characters when defining Width property.

• Standard SQL formats– Dates FXDD-MON-YY– Numbers L099G99D99

• Nonstandard formatsUse double quotes for embedded characters"("099")"099"-"0999

Note: Allow for format mask’s embedded characters when defining Width property.

66--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Initial ValuesInitial Values

• Are used for every new record• Can be overwritten• Must be compatible with item’s data type• Use:

– Raw value– System variable– Global variable– Form parameter– Form item– Sequence

• Are used for every new record• Can be overwritten• Must be compatible with item’s data type• Use:

– Raw value– System variable– Global variable– Form parameter– Form item– Sequence

66--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Navigational Behavior of Text ItemsNavigational Behavior of Text Items

• Established by order of entries in Object Navigator• Controlled by:

– Keyboard Navigable– Previous Navigation Item– Next Navigation Item

• Established by order of entries in Object Navigator• Controlled by:

– Keyboard Navigable– Previous Navigation Item– Next Navigation Item

66--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Database PropertiesDatabase Properties

Use properties in the Database group to control:• Item’s data source—base table item or control item• Query, insert, and update operations on an item• Maximum query length • Query case

Use properties in the Database group to control:• Item’s data source——base table item or control item• Query, insert, and update operations on an item• Maximum query length • Query case

66--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Functional PropertiesFunctional Properties

Item

Id Product Id Price Shipped Item Total10011 135 500 67,500.00

10013 380 400 152,000.00

12

Order

CREDIT

Order Id DateOrdered

DateShipped

PaymentType

100

Enabled=No

31-aug-1992

10-sep-1992

CaseRestriction=Upper

Justification =Start

Justification =Right

66--1717 Copyright Oracle Corporation, 2000. All rights reserved.

Conceal Data PropertyConceal Data Property

Enter Userid:

Enter Password:

scott

*****

Log Screen

66--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Keyboard Navigable and Enabled Properties

Keyboard Navigable and Enabled Properties

• Set both properties to allow or disallow navigation and interaction with text item.

• When Enabled is set to Yes, Keyboard Navigable can be set to Yes or No.

• When Enabled is set to No, the item is always nonnavigable.

• Set both properties to allow or disallow navigation and interaction with text item.

• When Enabled is set to Yes, Keyboard Navigable can be set to Yes or No.

• When Enabled is set to No, the item is always nonnavigable.

66--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Multiline Text ItemsMultiline Text Items

Text

Text

Text

Text

WidthWidth

HeightHeight

Total text = Maximum lengthTotal text = Maximum length

66--2020 Copyright Oracle Corporation, 2000. All rights reserved.

Help PropertiesHelp Properties

HintHint

66--2121 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Creating a text item• Modifying appearance• Controlling data• Altering navigational behavior• Enhancing relationship with database• Adding functionality• Including context-sensitive Help

• Creating a text item• Modifying appearance• Controlling data• Altering navigational behavior• Enhancing relationship with database• Adding functionality• Including context-sensitive Help

66--2222 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 6 OverviewPractice 6 Overview

This practice covers the following topics:• Deleting text items• Modifying text item properties• Creating text items

This practice covers the following topics:• Deleting text items• Modifying text item properties• Creating text items

Copyright Oracle Corporation, 2000. All rights reserved.

Creating LOVs and EditorsCreating LOVs and Editors

Copyright Oracle Corporation, 2000. All rights reserved.77--22

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Describe LOVs and editors• Design, create, and associate LOVs with text items

in a form module• Create editors and associate them with text items

in a form module

After completing this lesson, you should be able to do the following:• Describe LOVs and editors• Design, create, and associate LOVs with text items

in a form module• Create editors and associate them with text items

in a form module

Copyright Oracle Corporation, 2000. All rights reserved.77--33

LOVs and EditorsLOVs and Editors

Text item

Editor

Text item Text item

LOV

Supporting dataSupporting datarecord grouprecord group

Copyright Oracle Corporation, 2000. All rights reserved.77--44

LOVs and EditorsLOVs and Editors

• LOVs– List of values for text items– Dynamic or static list– Independent of single text items– Flexible and efficient

• Editors– Override default editor– Used for special requirements such as larger

editing window, position, color, and title– System editor available as an option

• LOVs– List of values for text items– Dynamic or static list– Independent of single text items– Flexible and efficient

• Editors– Override default editor– Used for special requirements such as larger

editing window, position, color, and title– System editor available as an option

Copyright Oracle Corporation, 2000. All rights reserved.77--55

LOVs and Record GroupsLOVs and Record Groups

Text item

LOV

Text item

LOV

Record group

SQL

DatabaseDatabase

Record groupRecord groupRecord groupbased onbased onstatic datastatic data

QueryQuery--basedbasedrecordrecordgroupgroup

OROR

Copyright Oracle Corporation, 2000. All rights reserved.77--66

LOVsLOVs

S_CUSTOMERS_CUSTOMER tabletableSELECT name, id, phone, cityFROM s_customerORDER BY name

SELECT name, id, phone, cityFROM s_customerORDER BY name

name id phone cityCustomersCustomersrecord grouprecord group

CustomersCustomersLOVLOV

Copyright Oracle Corporation, 2000. All rights reserved.77--77

Creating an LOV Using the LOV Wizard: SQL Query Page

Creating an LOV Using the LOV Wizard: SQL Query Page

Copyright Oracle Corporation, 2000. All rights reserved.77--88

Creating an LOV Using the LOV Wizard: Column Selection Page

Creating an LOV Using the LOV Wizard: Column Selection Page

Copyright Oracle Corporation, 2000. All rights reserved.77--99

Creating an LOV Using the LOV Wizard: Column Properties Page

Creating an LOV Using the LOV Wizard: Column Properties Page

Copyright Oracle Corporation, 2000. All rights reserved.77--1010

Creating an LOV Using the LOV Wizard: Display Page

Creating an LOV Using the LOV Wizard: Display Page

Copyright Oracle Corporation, 2000. All rights reserved.77--1111

Creating an LOV Using the LOV Wizard: Advanced Properties Page

Creating an LOV Using the LOV Wizard: Advanced Properties Page

Copyright Oracle Corporation, 2000. All rights reserved.77--1212

LOV PropertiesLOV Properties

Filter BeforeDisplay

?

(X,Y)(X,Y)

AutomaticAutomaticSelectSelect

AutomaticAutomaticSkipSkip

Automatic DisplayAutomatic Display

WidthWidth

HeightHeight

LOV

Column MappingColumn Mapping

Return ItemsReturn Items

Copyright Oracle Corporation, 2000. All rights reserved.77--1313

LOV PropertiesLOV Properties

LOV

Column MappingColumn Mapping

Return ItemsReturn Items

AutomaticAutomaticPositionPosition

AutomaticAutomaticColumn WidthColumn Width

Copyright Oracle Corporation, 2000. All rights reserved.77--1414

LOV Column MappingLOV Column Mapping

S_CUSTOMER tableS_CUSTOMER tableSELECT name, id, phone, cityFROM s_customerORDER BY name

SELECT name, id, phone, cityFROM s_customerORDER BY name

name id phone cityCustomersCustomersrecord grouprecord group

CustomersCustomersLOVLOV

customer.name customer.id

Phone City809-352689 San Pedro De 1-415-555-6281 San Francisco91-1031 New Delhi52-404562 Nogales

Hidden columnsHidden columns

customer.phone customer.city

Copyright Oracle Corporation, 2000. All rights reserved.77--1515

EditorsEditors

Copyright Oracle Corporation, 2000. All rights reserved.77--1616

EditorsEditors

• Associate one of three types of editors with a text item.

• Set text item’s Editor property to one of the following:– Null (default Form Builder editor)– editor_name (customized editor)– SYSTEM_EDITOR (external editor)

• Associate one of three types of editors with a text item.

• Set text item’s Editor property to one of the following:– Null (default Form Builder editor)– editor_name (customized editor)– SYSTEM_EDITOR (external editor)

Copyright Oracle Corporation, 2000. All rights reserved.77--1717

SummarySummary

• LOVs and editors are form objects.• LOVs and editors can be shared across text items.• There are three steps to implement an LOV.• Text items can use the default editor, a custom

editor, or a system editor.

• LOVs and editors are form objects.• LOVs and editors can be shared across text items.• There are three steps to implement an LOV.• Text items can use the default editor, a custom

editor, or a system editor.

Copyright Oracle Corporation, 2000. All rights reserved.77--1818

Practice 7 OverviewPractice 7 Overview

This practice covers the following topics:• Creating an LOV and attaching the LOV

to a text item• Creating an editor and attaching the editor

to a text item

This practice covers the following topics:• Creating an LOV and attaching the LOV

to a text item• Creating an editor and attaching the editor

to a text item

Copyright Oracle Corporation, 2000. All rights reserved.

Creating Additional Input ItemsCreating Additional Input Items

88--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Identify the item types that allow input• Create a check box• Create a list item• Create a radio group

After completing this lesson, you should be able to do the following:• Identify the item types that allow input• Create a check box• Create a list item• Create a radio group

88--33 Copyright Oracle Corporation, 2000. All rights reserved.

Input ItemsInput Items

• Item types that accept user input include:– Check boxes– List items– Radio groups

• Input items enable insert, update, delete, and query.

• Item types that accept user input include:– Check boxes– List items– Radio groups

• Input items enable insert, update, delete, and query.

88--44 Copyright Oracle Corporation, 2000. All rights reserved.

Check BoxesCheck Boxes

• Two-state interface object:– Checked– Unchecked

• Not limited to two values

• Two-state interface object:– Checked– Unchecked

• Not limited to two values

88--55 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Check BoxCreating a Check Box

• Convert an existing item.• Use the Check Box tool in the Layout Editor.• Use the Create icon in the Object Navigator.

• Convert an existing item.• Use the Check Box tool in the Layout Editor.• Use the Create icon in the Object Navigator.

88--66 Copyright Oracle Corporation, 2000. All rights reserved.

Check Box Specific PropertiesCheck Box Specific Properties

• Data Type• Label• Access Key• Value When Checked

• Data Type• Label• Access Key• Value When Checked

• Value When Unchecked

• Check Box Mapping of Other Values

• Mouse Navigate

• Value When Unchecked

• Check Box Mapping of Other Values

• Mouse Navigate

88--77 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Check BoxCreating a Check Box

88--88 Copyright Oracle Corporation, 2000. All rights reserved.

Check Box Mapping of Other Values

Check Box Mapping of Other Values

YY

YY

NN

NullNull

AA

Order_FilledOrder_Filled CheckedChecked

UncheckedUnchecked

Check Box Mapping ofCheck Box Mapping ofOther ValuesOther Values

UncheckedUnchecked

YY

NN

88--99 Copyright Oracle Corporation, 2000. All rights reserved.

List ItemsList Items

• Set of mutually exclusive choices, each representing a different value

• Three list styles available• Space-saving alternative to a radio group• Smaller-scale alternative to an LOV

• Set of mutually exclusive choices, each representing a different value

• Three list styles available• Space-saving alternative to a radio group• Smaller-scale alternative to an LOV

88--1010 Copyright Oracle Corporation, 2000. All rights reserved.

List StylesList Styles

Excellent PoplistPoplist

TlistTlistGood

Poor

Excellent

Excellent Combo BoxCombo Box

88--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a List ItemCreating a List Item

• Convert an existing item.• Use the List Item tool in the Layout Editor.• Use the Create icon in the Object Navigator.

• Convert an existing item.• Use the List Item tool in the Layout Editor.• Use the Create icon in the Object Navigator.

88--1212 Copyright Oracle Corporation, 2000. All rights reserved.

List Item Specific PropertiesList Item Specific Properties

• Elements in List:– List elements– List item value

• List Style• Mapping of Other Values• Mouse Navigate

• Elements in List:– List elements– List item value

• List Style• Mapping of Other Values• Mouse Navigate

88--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a List ItemCreating a List Item

88--1414 Copyright Oracle Corporation, 2000. All rights reserved.

List Item Mapping of Other Values

List Item Mapping of Other Values

Credit_RatingCredit_Rating

EXCELLENTEXCELLENT

GOODGOOD

POORPOORFAIRFAIR

EXCELLENTEXCELLENT

Excellent

Good

Poor

List ElementsList Elements

Mapping of Other Mapping of Other Values = PoorValues = Poor

88--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Radio GroupsRadio Groups

• Set of mutually exclusive radio buttons, each representing a value

• Use:– To display two or more static choices– As an alternative to a list item– As an alternative to a check box

• Set of mutually exclusive radio buttons, each representing a value

• Use:– To display two or more static choices– As an alternative to a list item– As an alternative to a check box

88--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Radio GroupCreating a Radio Group

• Convert an existing item.• Create a new radio group item in the Layout

Editor.• Use the Create icon in the Object Navigator.

• Convert an existing item.• Create a new radio group item in the Layout

Editor.• Use the Create icon in the Object Navigator.

88--1717 Copyright Oracle Corporation, 2000. All rights reserved.

Radio Group and Radio Button Specific Properties

Radio Group and Radio Button Specific Properties

Radio group• Data Type • Mapping of Other

Values• Mouse Navigate

Radio group• Data Type • Mapping of Other

Values• Mouse Navigate

Radio button• Access Key• Label• Radio Button Value

Radio button• Access Key• Label• Radio Button Value

88--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Creating Radio ButtonsCreating Radio Buttons

88--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Radio Group Mapping of Other Values

Radio Group Mapping of Other Values

Payment_TypePayment_Type

CASHCASH

CHECKCHECKCREDITCREDIT

NullNull

List ElementsList Elements

BUTTON1Cash

BUTTON2Credit

BUTTON3

Mapping ofOther Values

BUTTON1

88--2020 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Check boxes• List items• Radio groups

• Check boxes• List items• Radio groups

88--2121 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 8 OverviewPractice 8 Overview

This practice covers the following topics:• Converting a text item into a list item• Converting a text item into a check box item• Converting a text item into a radio group• Adding radio buttons to the radio group

This practice covers the following topics:• Converting a text item into a list item• Converting a text item into a check box item• Converting a text item into a radio group• Adding radio buttons to the radio group

Copyright Oracle Corporation, 2000. All rights reserved.

Creating Noninput ItemsCreating Noninput Items

99--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Identify item types that do not allow input• Create a display item• Create an image item• Create a sound item• Create a button• Create a calculated item• Create a hierarchical tree item

After completing this lesson, you should be able to do the following:• Identify item types that do not allow input• Create a display item• Create an image item• Create a sound item• Create a button• Create a calculated item• Create a hierarchical tree item

99--33 Copyright Oracle Corporation, 2000. All rights reserved.

Noninput ItemsNoninput Items

Item types that do not accept direct user inputinclude:• Display items• Image items• Sound items• Buttons• Calculated items• Hierarchical tree items

Item types that do not accept direct user inputinclude:• Display items• Image items• Sound items• Buttons• Calculated items• Hierarchical tree items

99--44 Copyright Oracle Corporation, 2000. All rights reserved.

Display ItemsDisplay Items

• Display items are similar to text items.• Display items cannot:

– Be edited– Be queried– Be navigated to– Accept user input

• Display items can:– Display data– Conserve resources

• Display items are similar to text items.• Display items cannot:

– Be edited– Be queried– Be navigated to– Accept user input

• Display items can:– Display data– Conserve resources

99--55 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Display ItemCreating a Display Item

99--66 Copyright Oracle Corporation, 2000. All rights reserved.

Image ItemsImage Items

• Interface control• Use to display bitmapped images:

– From file system—supported file type– From database—LONG RAW column or a

BLOB column

• Interface control• Use to display bitmapped images:

– From file system——supported file type– From database——LONG RAW column or a

BLOB column

99--77 Copyright Oracle Corporation, 2000. All rights reserved.

Image File FormatsImage File Formats

PICT

TPIC

CALS

TIFF

GIF

JFIF

BMP

RAS

Image itemImage item

Image filesImage files Image filesImage files

Read Write

CALS

GIF

BMP

RAS

JPG

TIFF

JFIF

JPEG

PICT

TPIC

99--88 Copyright Oracle Corporation, 2000. All rights reserved.

Image-Specific Item PropertiesImage-Specific Item Properties

• Image Format• Image Depth• Compression Quality• Display Quality• Show Palette• Sizing Style• Show Horizontal Scrollbar• Show Vertical Scrollbar

• Image Format• Image Depth• Compression Quality• Display Quality• Show Palette• Sizing Style• Show Horizontal Scrollbar• Show Vertical Scrollbar

99--99 Copyright Oracle Corporation, 2000. All rights reserved.

Image Manipulation PaletteImage Manipulation Palette

ZoomZoomPanPan

RotateRotate

SelectSelect

99--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Creating an Image ItemCreating an Image Item

99--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Sound ItemsSound Items

• Interface control• Use to play and record sound:

– From file system—supported sound types– From database—LONG RAW column or BLOB

column

• Interface control• Use to play and record sound:

– From file system——supported sound types– From database——LONG RAW column or BLOB

column

99--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Sound Item Control Sound Item Control

PlayPlayPlay

RecordRecordRecord

RewindRewindRewind

FastFastFastForwardForwardForward

VolumeVolumeVolume

Time IndicatorTime IndicatorTime Indicator

SliderSliderSlider

99--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Sound TypesSound Types

AUAU

AIFFAIFF

AIFFAIFF--CC

WAVWAV

99--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Sound-Specific Item PropertiesSound-Specific Item Properties

• Sound Format• Audio Channels• Compress• Sound Quality• Show Play/Record/Rewind/Fast Forward/Volume

Control/Time Indicator/Slider Button

• Sound Format• Audio Channels• Compress• Sound Quality• Show Play/Record/Rewind/Fast Forward/Volume

Control/Time Indicator/Slider Button

99--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Sound ItemCreating a Sound Item

99--1616 Copyright Oracle Corporation, 2000. All rights reserved.

ButtonsButtons

• Interface control• Cannot display/represent data• Use to initiate an action• Display as:

– Text button– Iconic

• Interface control• Cannot display/represent data• Use to initiate an action• Display as:

– Text button– Iconic

99--1717 Copyright Oracle Corporation, 2000. All rights reserved.

ButtonsButtons

• Use buttons to:– Move input focus– Display an LOV– Invoke an editor– Invoke another window– Commit data– Issue a query– Perform calculations

• Use buttons to:– Move input focus– Display an LOV– Invoke an editor– Invoke another window– Commit data– Issue a query– Perform calculations

99--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Button-Specific Item PropertiesButton-Specific Item Properties

• Label• Mouse Navigate• Default Button• Iconic• Icon Filename• Tooltip• Tooltip Visual Attribute Group

• Label• Mouse Navigate• Default Button• Iconic• Icon Filename• Tooltip• Tooltip Visual Attribute Group

99--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Tool TipTool Tip

99--2020 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a ButtonCreating a Button

99--2121 Copyright Oracle Corporation, 2000. All rights reserved.

Calculated ItemsCalculated Items

• They accept item values that are based on calculations.

• They are read-only.• They can be expressed as:

– Formula– Summary

• They accept item values that are based on calculations.

• They are read-only.• They can be expressed as:

– Formula– Summary

99--2222 Copyright Oracle Corporation, 2000. All rights reserved.

Calculation ModesCalculation Modes

• Formula– A calculated item value is the result of a

horizontal calculation.– It involves bind variables.

• Summary– A calculated item value is a vertical

calculation.– A summary is performed on values of a single

item over all rows in a block.

• Formula– A calculated item value is the result of a

horizontal calculation.– It involves bind variables.

• Summary– A calculated item value is a vertical

calculation.– A summary is performed on values of a single

item over all rows in a block.

99--2323 Copyright Oracle Corporation, 2000. All rights reserved.

Item Properties Specific to the Calculated Item

Item Properties Specific to the Calculated Item

Formula• Calculation Mode• Formula

Formula• Calculation Mode• Formula

Summary• Calculation Mode• Summary Function• Summarized Block• Summarized Item

Summary• Calculation Mode• Summary Function• Summarized Block• Summarized Item

99--2424 Copyright Oracle Corporation, 2000. All rights reserved.

Summary FunctionsSummary Functions

• AVG• COUNT• MAX• MIN• STDDEV• SUM• VARIANCE

• AVG• COUNT• MAX• MIN• STDDEV• SUM• VARIANCE

99--2525 Copyright Oracle Corporation, 2000. All rights reserved.

Item Based on a FormulaItem Based on a Formula

ORDERSOrder

Item id Product id Price Qty ShippedItemTotal

12

43

2001205025

5493

1,00048045075

NVL((:s_item.price * :s_item.quantity_shipped),0)NVL((:s_item.price * :s_item.quantity_shipped),0)

Item

Formulaitem

99--2626 Copyright Oracle Corporation, 2000. All rights reserved.

Rules for Formula ItemsRules for Formula Items

• A formula item must not invoke restricted built-ins.• A formula item cannot execute any DML

statements.• Do not terminate a PL/SQL expression with a

semicolon.• Do not enter a complete PL/SQL statement in

assignment expressions.

• A formula item must not invoke restricted built-ins.• A formula item cannot execute any DML

statements.• Do not terminate a PL/SQL expression with a

semicolon.• Do not enter a complete PL/SQL statement in

assignment expressions.

99--2727 Copyright Oracle Corporation, 2000. All rights reserved.

Item Based on a Summary Item Based on a Summary

ORDERSOrder

Item id Product id Price Qty ShippedItemTotal

12

43

2001205025

5493

1,00048045075

Item

2,005Order Total

Summarizeditem

Summaryitem

99--2828 Copyright Oracle Corporation, 2000. All rights reserved.

Rules for Summary ItemsRules for Summary Items

• Summary item must reside in: – The same block as the summarized item– A control block with Single Record property

set to Yes• Summarized item must reside in:

– A data block with Query All Records property or Precompute Summaries property set to Yes

– A control block• Datatype of summary item must be Number,

unless using MAX or MIN

• Summary item must reside in: – The same block as the summarized item– A control block with Single Record property

set to Yes• Summarized item must reside in:

– A data block with Query All Records property or Precompute Summaries property set to Yes

– A control block• Datatype of summary item must be Number,

unless using MAX or MIN

99--2929 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Hierarchical TreeCreating a Hierarchical Tree

99--3030 Copyright Oracle Corporation, 2000. All rights reserved.

Hierarchical Tree PropertiesHierarchical Tree Properties

• Allow empty branches• Multi selection• Show lines• Show symbols• Record group• Data query

• Allow empty branches• Multi selection• Show lines• Show symbols• Record group• Data query

99--3131 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Display items• Image items• Sound items• Buttons• Calculated items• Hierarchical tree items

• Display items• Image items• Sound items• Buttons• Calculated items• Hierarchical tree items

99--3232 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 9 OverviewPractice 9 Overview

This practice covers the following topics:• Creating display items• Creating an image item• Creating iconic buttons• Creating calculated items:

– Formula– Summary

This practice covers the following topics:• Creating display items• Creating an image item• Creating iconic buttons• Creating calculated items:

– Formula– Summary

Copyright Oracle Corporation, 2000. All rights reserved.

Creating Windows and Content CanvasesCreating Windows and Content Canvases

1010--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Describe windows and content canvases• Describe the relationship between windows and

content canvases

After completing this lesson, you should be able to do the following:• Describe windows and content canvases• Describe the relationship between windows and

content canvases

1010--33 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

• Identify window and content canvas properties• Display a form module in multiple windows• Display a form module on multiple layouts

• Identify window and content canvas properties• Display a form module in multiple windows• Display a form module on multiple layouts

1010--44 Copyright Oracle Corporation, 2000. All rights reserved.

Windows and CanvasesWindows and Canvases

• Window: Container for Form Builder visual objects

• Canvas: Surface on which you “paint” visual objectsTo see a canvas and its objects, display the canvas in a window.

• Window: Container for Form Builder visual objects

• Canvas: Surface on which you “paint” visual objectsTo see a canvas and its objects, display the canvas in a window.

1010--55 Copyright Oracle Corporation, 2000. All rights reserved.

Window, Canvas, and ViewportWindow, Canvas, and Viewport

MDI MDI MDI parentparentparentwindowwindowwindow

DocumentDocumentDocumentwindowwindowwindow

CanvasCanvasCanvas

1010--66 Copyright Oracle Corporation, 2000. All rights reserved.

Content CanvasContent Canvas

• “Base” canvas• View occupies entire window• Default canvas type• Each window should have at least one content

canvas

• “Base” canvas• View occupies entire window• Default canvas type• Each window should have at least one content

canvas

1010--77 Copyright Oracle Corporation, 2000. All rights reserved.

Windows and Content CanvasesWindows and Content Canvases

Canvas 2Canvas 2 Canvas 3Canvas 3

Canvas 1Canvas 1

WindowWindow

1010--88 Copyright Oracle Corporation, 2000. All rights reserved.

WindowsWindows

• WINDOW1:– It is created by default with each new form

module.– It is modeless.– You can delete, rename, or change its

attributes.

• WINDOW1:– It is created by default with each new form

module.– It is modeless.– You can delete, rename, or change its

attributes.

1010--99 Copyright Oracle Corporation, 2000. All rights reserved.

WindowsWindows

• Use additional windows to:– Display two or more content canvases at once– Modularize form contents– Switch between canvases without replacing

the initial one– Take advantage of the window manager

• Two types of windows:– Modal – Modeless

• Use additional windows to:– Display two or more content canvases at once– Modularize form contents– Switch between canvases without replacing

the initial one– Take advantage of the window manager

• Two types of windows:– Modal – Modeless

1010--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Window PropertiesWindow Properties

4

5

6

7

2

13

1010--1111 Copyright Oracle Corporation, 2000. All rights reserved.

GUI HintsGUI Hints

• GUI hints are recommendations to the window manager about window appearance and functionality.

• If the window manager supports a specific GUI Hint and its property is set to Yes, it will be used.

• Functional properties for GUI Hints:- Close Allowed - Maximize Allowed- Move Allowed - Minimize Allowed- Resize Allowed - Inherit Menu

• GUI hints are recommendations to the window manager about window appearance and functionality.

• If the window manager supports a specific GUI Hint and its property is set to Yes, it will be used.

• Functional properties for GUI Hints:- Close Allowed - Maximize Allowed- Move Allowed - Minimize Allowed- Resize Allowed - Inherit Menu

1010--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Content CanvasCreating a Content Canvas

• Implicitly:– Using the Layout Wizard– Using the Layout Editor

• Explicitly: Using the Create icon in theObject Navigator

• Implicitly:– Using the Layout Wizard– Using the Layout Editor

• Explicitly: Using the Create icon in theObject Navigator

1010--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Content Canvas PropertiesContent Canvas Properties

HeightHeight

WidthWidth

CanvasCanvas

Viewport X/YViewport X/YPositionPositionon canvason canvas

ViewportViewport

1010--1414 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Describing windows and content canvases• Creating a new window• Creating a new content canvas

• Describing windows and content canvases• Creating a new window• Creating a new content canvas

1010--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 10 OverviewPractice 10 Overview

This practice covers the following topics:• Changing a window size, position, name, and title• Creating a new window• Displaying data block contents in the new window

This practice covers the following topics:• Changing a window size, position, name, and title• Creating a new window• Displaying data block contents in the new window

Copyright Oracle Corporation, 2000. All rights reserved.

Working with Other CanvasesWorking with Other Canvases

1111--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Describe the different types of canvases and their

relationships to each other• Identify the appropriate canvas type for different

scenarios• Create an overlay effect by using stacked

canvases• Create a toolbar• Create a tabbed interface

After completing this lesson, you should be able to do the following:• Describe the different types of canvases and their

relationships to each other• Identify the appropriate canvas type for different

scenarios• Create an overlay effect by using stacked

canvases• Create a toolbar• Create a tabbed interface

1111--33 Copyright Oracle Corporation, 2000. All rights reserved.

Content canvasContent canvas

Canvas TypesCanvas Types

StackedStackedcanvascanvas

Horizontal toolbarHorizontal toolbar

VerticalVerticaltoolbartoolbar

x y zTabTab

TabTabpagepage

1111--44 Copyright Oracle Corporation, 2000. All rights reserved.

Stacked CanvasStacked Canvas

• Displayed on top of a content canvas• Shares a window with a content canvas• Size:

– Usually smaller than the content canvas in the same window

– Determined by viewport size• Created in:

– Object Navigator– Layout Editor

• Displayed on top of a content canvas• Shares a window with a content canvas• Size:

– Usually smaller than the content canvas in the same window

– Determined by viewport size• Created in:

– Object Navigator– Layout Editor

1111--55 Copyright Oracle Corporation, 2000. All rights reserved.

Stacked Canvas PropertiesStacked Canvas Properties

1 2

3

5

4

1111--66 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Stacked CanvasCreating a Stacked Canvas

1111--77 Copyright Oracle Corporation, 2000. All rights reserved.

ToolbarsToolbars

• Special type of canvas for tool items• Three types:

– Vertical toolbar– Horizontal toolbar– MDI toolbar

• Provide:– Standard look and feel– Alternative to menu or function key operation

• Special type of canvas for tool items• Three types:

– Vertical toolbar– Horizontal toolbar– MDI toolbar

• Provide:– Standard look and feel– Alternative to menu or function key operation

1111--88 Copyright Oracle Corporation, 2000. All rights reserved.

Toolbar Related PropertiesToolbar Related Properties

• Canvas properties:– Canvas Type– Window– Width– Height

• Canvas properties:– Canvas Type– Window– Width– Height

1111--99 Copyright Oracle Corporation, 2000. All rights reserved.

Toolbar Related PropertiesToolbar Related Properties

• Window properties:– Horizontal Toolbar Canvas– Vertical Toolbar Canvas

• Form Module properties:– Form Horizontal Toolbar Canvas– Form Vertical Toolbar Canvas

• Window properties:– Horizontal Toolbar Canvas– Vertical Toolbar Canvas

• Form Module properties:– Form Horizontal Toolbar Canvas– Form Vertical Toolbar Canvas

1111--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Tab CanvasTab Canvas

• Enables you to organize and display related information on separate tabs

• Consists of one or more tab pages• Provides easy access to data• Created in:

– Object Navigator– Layout Editor

• Enables you to organize and display related information on separate tabs

• Consists of one or more tab pages• Provides easy access to data• Created in:

– Object Navigator– Layout Editor

1111--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Tab Canvas Related PropertiesTab Canvas Related Properties

1

2

3

4

1111--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a Tab CanvasCreating a Tab Canvas

1111--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Placing Items on a Tab CanvasPlacing Items on a Tab Canvas

• Place items on each tab page for user interaction.• Set the item properties:

– Canvas– Tab Page

• Place items on each tab page for user interaction.• Set the item properties:

– Canvas– Tab Page

1111--1414 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Creating an overlay effect with a stacked canvas• Creating a toolbar• Creating a tab canvas

• Creating an overlay effect with a stacked canvas• Creating a toolbar• Creating a tab canvas

1111--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 11 OverviewPractice 11 Overview

This practice covers the following topics:• Creating a toolbar canvas• Creating a stacked canvas• Creating a tab canvas• Adding tab pages to the tab canvas

This practice covers the following topics:• Creating a toolbar canvas• Creating a stacked canvas• Creating a tab canvas• Adding tab pages to the tab canvas

Copyright Oracle Corporation, 2000. All rights reserved.

Introduction to TriggersIntroduction to Triggers

1212--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Define triggers• Identify the different trigger categories• Plan the type and scope of triggers in a form• Describe the properties that affect the behavior of

a trigger

After completing this lesson, you should be able to do the following:• Define triggers• Identify the different trigger categories• Plan the type and scope of triggers in a form• Describe the properties that affect the behavior of

a trigger

1212--33 Copyright Oracle Corporation, 2000. All rights reserved.

Form Builder TriggersForm Builder Triggers

EventEvent

Trigger typesTrigger types

QueriesQueries

ValidationValidation

NavigationNavigation

InteractionInteraction

Internal eventInternal event

Errors/MessagesErrors/Messages

OthersOthers

PL/SQL

FireFirePL/SQL

PL/SQL

1212--44 Copyright Oracle Corporation, 2000. All rights reserved.

Trigger Scope ComponentTrigger Scope Component

Type

CodeLevels• Form• Block• Item

Levels• Form• Block• Item

Scope

1212--55 Copyright Oracle Corporation, 2000. All rights reserved.

Trigger ScopeTrigger Scope

EventEvent

Event

1212--66 Copyright Oracle Corporation, 2000. All rights reserved.

Trigger Type ComponentTrigger Type Component

TypeScope

Code

• Pre-• Post-• When-• On-• Key-

• Pre-• Post-• When-• On-• Key-

1212--77 Copyright Oracle Corporation, 2000. All rights reserved.

Trigger Code ComponentTrigger Code Component

TypeScopeCode

• Statements• PL/SQL• User subprograms• Built-in subprograms

• Statements• PL/SQL• User subprograms• Built-in subprograms

1212--88 Copyright Oracle Corporation, 2000. All rights reserved.

Execution HierarchyExecution Hierarchy

Formlevel

Blocklevel

Itemlevel

Event

On-Message

On-Message

On-Message

On-Error

On-Error

EH = After

EH = After

EH = Before

EH = Override

1

2

3

Event 4

1212--99 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Trigger: Event-activated program units• Type: Defines the event that fires it• Prefixes:

– Key-– On-– Pre-– Post-– When-

• Code: PL/SQL anonymous block• Scope: Form, block, or item level

• Trigger: Event-activated program units• Type: Defines the event that fires it• Prefixes:

– Key-– On-– Pre-– Post-– When-

• Code: PL/SQL anonymous block• Scope: Form, block, or item level

Copyright Oracle Corporation, 2000. All rights reserved.

Producing TriggersProducing Triggers

1313--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Write trigger code• Explain the use of built-in subprograms in Oracle

Forms Developer applications• Describe the When-Button-Pressed trigger• Describe the When-Window-Closed trigger

After completing this lesson, you should be able to do the following:• Write trigger code• Explain the use of built-in subprograms in Oracle

Forms Developer applications• Describe the When-Button-Pressed trigger• Describe the When-Window-Closed trigger

1313--33 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a TriggerCreating a Trigger

Smart Triggers

1313--44 Copyright Oracle Corporation, 2000. All rights reserved.

Trigger PropertiesTrigger Properties

GeneralGeneral

FunctionalFunctional

HelpHelp

1313--55 Copyright Oracle Corporation, 2000. All rights reserved.

PL/SQL EditorPL/SQL Editor

Split viewSplit view

1313--66 Copyright Oracle Corporation, 2000. All rights reserved.

PL/SQL Editor Syntax PalettePL/SQL Editor Syntax Palette

1313--77 Copyright Oracle Corporation, 2000. All rights reserved.

Database Trigger EditorDatabase Trigger Editor

1313--88 Copyright Oracle Corporation, 2000. All rights reserved.

Trigger PL/SQL BlocksTrigger PL/SQL Blocks.BEGIN

.END;

1313--99 Copyright Oracle Corporation, 2000. All rights reserved.

Variables in Form BuilderVariables in Form Builder

• PL/SQL variables must be declared in a trigger or defined in a package

• Form Builder variables– Are not formally declared in PL/SQL– Need a colon prefix in reference

• PL/SQL variables must be declared in a trigger or defined in a package

• Form Builder variables– Are not formally declared in PL/SQL– Need a colon prefix in reference

1313--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Form Builder VariablesForm Builder Variables

• ItemsFor presentation and user interaction

• Global variablesSession-wide character variable

• System variablesForm status and control

• ParametersPassing values in and out of module

• ItemsFor presentation and user interaction

• Global variablesSession-wide character variable

• System variablesForm status and control

• ParametersPassing values in and out of module

1313--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Syntax of VariablesSyntax of Variables

• :block_name.item_name• :GLOBAL.variable_name• :SYSTEM.variable_name• :PARAMETER.name

• :block_name.item_name• :GLOBAL.variable_name• :SYSTEM.variable_name• :PARAMETER.name

1313--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Form Builder Built-in Subprograms

Form Builder Built-in Subprograms

Built-ins belong to either:• The Standard Extensions package where no prefix

is required• Another Form Builder package where a prefix is

required

Built-ins belong to either:• The Standard Extensions package where no prefix

is required• Another Form Builder package where a prefix is

required

1313--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Limits of UseLimits of Use

• Unrestricted built-ins are allowed in any trigger or subprogram.

• Restricted built-ins are allowed only in certain triggers and subprograms called from such triggers.

• Consult the Help system.

• Unrestricted built-ins are allowed in any trigger or subprogram.

• Restricted built-ins are allowed only in certain triggers and subprograms called from such triggers.

• Consult the Help system.

1313--1414 Copyright Oracle Corporation, 2000. All rights reserved.

1

Using Built-in DefinitionsUsing Built-in Definitions

2

3

4

1313--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Useful Built-InsUseful Built-Ins

• EDIT_TEXTITEM• ENTER_QUERY, EXECUTE_QUERY• EXIT_FORM• GO_BLOCK, GO_ ITEM• GET_ITEM_PROPERTY, SET_ITEM_PROPERTY• MESSAGE• SHOW_ALERT, SHOW_ EDITOR, SHOW_ LOV• SHOW_VIEW, HIDE_VIEW

• EDIT_TEXTITEM• ENTER_QUERY, EXECUTE_QUERY• EXIT_FORM• GO_BLOCK, GO_ ITEM• GET_ITEM_PROPERTY, SET_ITEM_PROPERTY• MESSAGE• SHOW_ALERT, SHOW_ EDITOR, SHOW_ LOV• SHOW_VIEW, HIDE_VIEW

1313--1616 Copyright Oracle Corporation, 2000. All rights reserved.

When-Button-Pressed Trigger

When-Button-Pressed Trigger

• Fires when the operator clicks a button.• Accepts restricted and unrestricted

built-ins.• Use to provide convenient navigation, to display

LOVs and many other frequently used functions.

• Fires when the operator clicks a button.• Accepts restricted and unrestricted

built-ins.• Use to provide convenient navigation, to display

LOVs and many other frequently used functions.

ExampleExampleGO_BLOCK(‘Stock’);EXECUTE_QUERY;

1313--1717 Copyright Oracle Corporation, 2000. All rights reserved.

When-Window-ClosedTrigger

When-Window-ClosedTrigger

• Fires when the operator closes a window by using a window manager-specific close command.

• Accepts restricted and unrestricted built-ins.• Used to programmatically close a window when

the operator issues a window manager-specific close command. You can close a window by using built-ins.

• Fires when the operator closes a window by using a window manager-specific close command.

• Accepts restricted and unrestricted built-ins.• Used to programmatically close a window when

the operator issues a window manager-specific close command. You can close a window by using built-ins.

1313--1818 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

To produce a trigger:1. Select a scope in the Object Navigator.2. Create a trigger and select a Name from the LOV,

or use the SmartTriggers menu option.3. Define code in the PL/SQL Editor.4. Compile.

To produce a trigger:1. Select a scope in the Object Navigator.2. Create a trigger and select a Name from the LOV,

or use the SmartTriggers menu option.3. Define code in the PL/SQL Editor.4. Compile.

1313--1919 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Find built-ins in the Navigator under Built-in Packages: – Paste built-in name and arguments to your

code by using the Paste Name and Arguments option.

– Refer to online Help.• The When-Button-Pressed trigger provides a wide

range of functionality to users.• Use the When-Window-Closed trigger to provide

functionality when the user issues a window manager-specific close command.

• Find built-ins in the Navigator under Built-in Packages: – Paste built-in name and arguments to your

code by using the Paste Name and Arguments option.

– Refer to online Help.• The When-Button-Pressed trigger provides a wide

range of functionality to users.• Use the When-Window-Closed trigger to provide

functionality when the user issues a window manager-specific close command.

1313--2020 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 13 OverviewPractice 13 Overview

This practice covers the following topics:• Using built-ins to display LOVs• Using the When-Button-Pressed and

When-Window-Closed triggers to add functionality to items

• Using built-ins to display and hide the Help stack canvas

This practice covers the following topics:• Using built-ins to display LOVs• Using the When-Button-Pressed and

When-Window-Closed triggers to add functionality to items

• Using built-ins to display and hide the Help stack canvas

Copyright Oracle Corporation, 2000. All rights reserved.

Debugging TriggersDebugging Triggers

1414--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Describe the components of the Debugger• Run a form module in debug mode• Debug PL/SQL code

After completing this lesson, you should be able to do the following:• Describe the components of the Debugger• Run a form module in debug mode• Debug PL/SQL code

1414--33 Copyright Oracle Corporation, 2000. All rights reserved.

Debugging TriggersDebugging Triggers

Monitor and debug triggers by:• Compiling correct errors in the PL/SQL Editor• Displaying debug messages at run time• Invoking the PL/SQL Debugger

Monitor and debug triggers by:• Compiling correct errors in the PL/SQL Editor• Displaying debug messages at run time• Invoking the PL/SQL Debugger

1414--44 Copyright Oracle Corporation, 2000. All rights reserved.

Debugging TipsDebugging Tips

• Connect to the database for SQL compilation.• The line that fails is not always responsible.• Watch for missing semicolons and quotation

marks.• Define triggers at the correct level.• Place triggers where the event will happen.

• Connect to the database for SQL compilation.• The line that fails is not always responsible.• Watch for missing semicolons and quotation

marks.• Define triggers at the correct level.• Place triggers where the event will happen.

1414--55 Copyright Oracle Corporation, 2000. All rights reserved.

Running a Form in Debug ModeRunning a Form in Debug Mode

Run FormRun FormDebugDebug

Contains source Contains source code andcode andexecutable run fileexecutable run file

.FMX

(Compiles automatically)(Compiles automatically)

(Runs automatically)(Runs automatically)

Run Form inRun Form inDebug ModeDebug Mode

1414--66 Copyright Oracle Corporation, 2000. All rights reserved.

PL/SQL DebuggerPL/SQL Debugger

1

2

3

4

1414--77 Copyright Oracle Corporation, 2000. All rights reserved.

PL/SQL DebuggerPL/SQL Debugger

6 7 8 9 105

1414--88 Copyright Oracle Corporation, 2000. All rights reserved.

Invoking the Debugger and BreakpointsInvoking the Debugger and Breakpoints

Debug Debug modemode

1

2

1414--99 Copyright Oracle Corporation, 2000. All rights reserved.

Breakpoint and Debug TriggersBreakpoint and Debug Triggers

EveryEverystatementstatement

Debugger

Program UnitProgram Unit

Statement

Statement

Statement

Debugtrigger

Breakpointtrigger

Fire

Fire

Fire

Breakpoint

1414--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Debug TriggersDebug Triggers

1414--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Debug CommandsDebug Commands

Step overStep over

StepStepoutout

ResetReset

GOGO

1

2 StepStepintointo

1414--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Debug ExampleDebug Example

…calls...…calls...

Debug Example

The results are: ??WHENWHEN--BUTTONBUTTON--PRESSEDPRESSED

1

Procedure XYZ;

Function ABC;

23

4

5

1414--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Debugger: Setting a BreakpointDebugger: Setting a Breakpoint

1414--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Debugger: Stepping into CodeDebugger: Stepping into Code

1414--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Debugger: Checking VariablesDebugger: Checking Variables

1414--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Corrected CodeCorrected Code

FUNCTION abc (abc_param IN NUMBER) RETURN NUMBER

IS

v_total NUMBER := 0;

v_num3 NUMBER := 3;

v_num6 NUMBER := 6;

/*-- changed value to 6

*/

BEGIN

v_total := v_num3 * v_num6;

v_total := v_total + abc_param;

RETURN v_total;

END abc;

FUNCTION abc (abc_param IN NUMBER) RETURN NUMBER

IS

v_total NUMBER := 0;

v_num3 NUMBER := 3;

v_num6 NUMBER := 6;

/*-- changed value to 6

*/

BEGIN

v_total := v_num3 * v_num6;

v_total := v_total + abc_param;

RETURN v_total;

END abc;

1414--1717 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• To debug a form: Use the Run Form Debug button, and set breakpoints.

• Debug commands can be entered in the Interpreter pane or by using buttons.

• Set breakpoints to invoke the Debugger.• Break and Debug triggers are available to program

Debug Actions on events in the form.

• To debug a form: Use the Run Form Debug button, and set breakpoints.

• Debug commands can be entered in the Interpreter pane or by using buttons.

• Set breakpoints to invoke the Debugger.• Break and Debug triggers are available to program

Debug Actions on events in the form.

1414--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 14 OverviewPractice 14 Overview

This practice covers using the Debugger to help solve problems at run time.This practice covers using the Debugger to help solve problems at run time.

Copyright Oracle Corporation, 2000. All rights reserved.

Adding Functionality to ItemsAdding Functionality to Items

1515--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Supplement the functionality of input items by

using triggers and built-ins• Supplement the functionality of

noninput items by using triggers and built-ins

After completing this lesson, you should be able to do the following:• Supplement the functionality of input items by

using triggers and built-ins• Supplement the functionality of

noninput items by using triggers and built-ins

1515--33 Copyright Oracle Corporation, 2000. All rights reserved.

Item Interaction TriggersItem Interaction Triggers

When-Button-Pressed

When-Checkbox-Changed

When-Radio-Changed

When-Image-Pressed

When-Image-Activated

When-List-Changed

When-List-Activated

When-Tree-Node-Activated

When-Tree-Node-Expanded

When-Tree-Node-Selected

1515--44 Copyright Oracle Corporation, 2000. All rights reserved.

Coding Item Interaction TriggersCoding Item Interaction Triggers

• Valid commands:– SELECT statements– Standard PL/SQL constructs– All built-in subprograms

• Use When-Validate-“object” to trap the operator during validation.

• Valid commands:– SELECT statements– Standard PL/SQL constructs– All built-in subprograms

• Use When-Validate-“object” to trap the operator during validation.

1515--55 Copyright Oracle Corporation, 2000. All rights reserved.

When-Checkbox-ChangedWhen-Checkbox-Changed

Interacting with Check BoxesInteracting with Check Boxes

IF CHECKBOX_CHECKED(’S_ORD.order_filled’) THEN

SET_ITEM_PROPERTY(’S_ORD.date_shipped’,

UPDATE_ALLOWED, PROPERTY_FALSE);

ELSE

SET_ITEM_PROPERTY(’S_ORD.date_shipped’,

UPDATE_ALLOWED, PROPERTY_TRUE);

END IF;

IF CHECKBOX_CHECKED(’S_ORD.order_filled’) THEN

SET_ITEM_PROPERTY(’S_ORD.date_shipped’,

UPDATE_ALLOWED, PROPERTY_FALSE);

ELSE

SET_ITEM_PROPERTY(’S_ORD.date_shipped’,

UPDATE_ALLOWED, PROPERTY_TRUE);

END IF;

1515--66 Copyright Oracle Corporation, 2000. All rights reserved.

Changing List Items at Run TimeChanging List Items at Run Time

ADD_LIST_ELEMENTADD_LIST_ELEMENT

DELETE_LIST_ELEMENTDELETE_LIST_ELEMENT

Excellent

Excellent

Good

Poor

Index

1

2

3

1515--77 Copyright Oracle Corporation, 2000. All rights reserved.

Displaying LOVs from ButtonsDisplaying LOVs from Buttons

• Uses:– Convenient alternative for accessing LOVs– Can display independently of text items

• Needs:– When-Button-Pressed trigger– LIST_VALUES or SHOW_LOV built-in

• Uses:– Convenient alternative for accessing LOVs– Can display independently of text items

• Needs:– When-Button-Pressed trigger– LIST_VALUES or SHOW_LOV built-in

1515--88 Copyright Oracle Corporation, 2000. All rights reserved.

LOVs and ButtonsLOVs and Buttons

Employee_IdLOV button

IF SHOW_LOV(’myLov’)

THEN...

IF SHOW_LOV(’myLov’)

THEN...

When-Button-PressedName DarylJayne ChristianClaudiaSergeiLisaPam

ID 101102 103104105106107

105

Employees (LOV)

105

1515--99 Copyright Oracle Corporation, 2000. All rights reserved.

v

^

Populating Image ItemsPopulating Image Items

DatabaseDatabase

Fetch on query

Image file in the Image file in the file systemfile system

WRITE_IMAGE_FILE

READ_IMAGE_FILE

1515--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Loading the Right ImageLoading the Right Image

READ_IMAGE_FILE(

’F_’||TO_CHAR(:S_ITEM.product_id)||’.BMP’,

’BMP’,

’S_ITEM.product_image’ );

READ_IMAGE_FILE(

’F_’||TO_CHAR(:S_ITEM.product_id)||’.BMP’,

’BMP’,

’S_ITEM.product_image’ );

1515--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Interacting with Sound ItemsInteracting with Sound Items

GET_ITEM_PROPERTY and SET_ITEM_PROPERTY:• SHOW_FAST_FORWARD_BUTTON• SHOW_PLAY_BUTTON• SHOW_RECORD_BUTTON• SHOW_REWIND_BUTTON• SHOW_SLIDER• SHOW_TIME_INDICATOR• SHOW_VOLUME_CONTROL

GET_ITEM_PROPERTY and SET_ITEM_PROPERTY:• SHOW_FAST_FORWARD_BUTTON• SHOW_PLAY_BUTTON• SHOW_RECORD_BUTTON• SHOW_REWIND_BUTTON• SHOW_SLIDER• SHOW_TIME_INDICATOR• SHOW_VOLUME_CONTROL

1515--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Populating Hierarchy TreesPopulating Hierarchy Trees

SET_TREE_PROPERTY

DatabaseDatabase

WhenWhen--NewNew--FormForm--InstanceInstance

CREATE_GROUP_FROM_QUERY

Record GroupRecord Group

CarFordVolvoVWToyota

-

1515--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Displaying Hierarchy TreesDisplaying Hierarchy Trees

WHEN-NEW-FORM-INSTANCEWHEN-NEW-FORM-INSTANCE

rg_emps := create_group_from_query(‘rg_emps’

‘select 1, level, last_name, NULL,

to_char(id) ‘ ||

‘from s_emp ‘ ||

‘connect by prior id= manager_id ‘||

‘start with title = ‘‘President’’’);

v_ignore := populate_group(rg_emps);

ftree.set_tree_property(‘block4.tree5’,

ftree.record_group, rg_emps);

rg_emps := create_group_from_query(‘rg_emps’

‘select 1, level, last_name, NULL,

to_char(id) ‘ ||

‘from s_emp ‘ ||

‘connect by prior id= manager_id ‘||

‘start with title = ‘‘President’’’);

v_ignore := populate_group(rg_emps);

ftree.set_tree_property(‘block4.tree5’,

ftree.record_group, rg_emps);

create_group_from_query(‘rg_emps’,

‘select 1, level, last_name, NULL,

to_char(id) ‘ ||

‘from s_emp ‘ ||

‘connect by prior id= manager_id ‘||

‘start with title = ‘‘President’’’);

set_tree_property

1515--1414 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Item interaction triggers accept SELECT statements and other standard PL/SQL constructs.

• You use built-ins for check boxes, LOV control, list item control, image file reading, hierarchical tree, and sound item control.

• Item interaction triggers accept SELECT statements and other standard PL/SQL constructs.

• You use built-ins for check boxes, LOV control, list item control, image file reading, hierarchical tree, and sound item control.

1515--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 15 OverviewPractice 15 Overview

This practice covers the following topics:• Writing a trigger to check whether the customer’s

credit rating forces him to pay cash• Creating a toolbar button to display and hide

product images

This practice covers the following topics:• Writing a trigger to check whether the customer’s

credit rating forces him to pay cash• Creating a toolbar button to display and hide

product images

Copyright Oracle Corporation, 2000. All rights reserved.

Runform Messages and AlertsRunform Messages and Alerts

1616--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Describe the default messaging • Handle errors using built-in subprograms• Identify the different types of Form Builder

messages• Control system messages• Create and control alerts

After completing this lesson, you should be able to do the following:• Describe the default messaging • Handle errors using built-in subprograms• Identify the different types of Form Builder

messages• Control system messages• Create and control alerts

1616--33 Copyright Oracle Corporation, 2000. All rights reserved.

Communicating with the OperatorCommunicating with the Operator

System Application

AlertsAlerts

MessagesMessagesInformative

ErrorWorking

Application

1616--44 Copyright Oracle Corporation, 2000. All rights reserved.

Detecting Run Time ErrorsDetecting Run Time Errors

• FORM_SUCCESS– TRUE: Action successful– FALSE: Error/Fatal error occurred

• FORM_FAILURE– TRUE: A nonfatal error occurred– FALSE: No error/No fatal error

• FORM_FATAL– TRUE: A fatal error occurred– FALSE: No error/No nonfatal error

• FORM_SUCCESS– TRUE: Action successful– FALSE: Error/Fatal error occurred

• FORM_FAILURE– TRUE: A nonfatal error occurred– FALSE: No error/No fatal error

• FORM_FATAL– TRUE: A fatal error occurred– FALSE: No error/No nonfatal error

1616--55 Copyright Oracle Corporation, 2000. All rights reserved.

Errors and Built-insErrors and Built-ins

• Built-in failure does not cause an exception.• Test built-in success with FORM_SUCCESS

function.IF FORM_SUCCESS THEN . . .

• What went wrong?– ERROR_CODE, ERROR_TEXT, ERROR_TYPE– MESSAGE _CODE, MESSAGE _TEXT,

MESSAGE _TYPE

• Built-in failure does not cause an exception.• Test built-in success with FORM_SUCCESS

function.IF FORM_SUCCESS THEN . . .

• What went wrong?– ERROR_CODE, ERROR_TEXT, ERROR_TYPE– MESSAGE _CODE, MESSAGE _TEXT,

MESSAGE _TYPE

1616--66 Copyright Oracle Corporation, 2000. All rights reserved.

Message Severity LevelsMessage Severity Levels

>25

2020

1515

1010

55

00

2525

All (default)All (default)

More criticalMore critical

Define by:Define by:

:SYSTEM.MESSAGE_LEVEL:SYSTEM.MESSAGE_LEVEL

1616--77 Copyright Oracle Corporation, 2000. All rights reserved.

Suppressing MessagesSuppressing Messages

:SYSTEM.MESSAGE_LEVEL := ’5’;

UP;

IF NOT FORM_SUCCESS THEN

MESSAGE(’Already at the first Order’);

END IF;

:SYSTEM.MESSAGE_LEVEL := ’0’;

:SYSTEM.MESSAGE_LEVEL := ’5’;

UP;

IF NOT FORM_SUCCESS THEN

MESSAGE(’Already at the first Order’);

END IF;

:SYSTEM.MESSAGE_LEVEL := ’0’;

:SYSTEM.SUPPRESS_WORKING := ’TRUE’;:SYSTEM.SUPPRESS_WORKING := ’TRUE’;

1616--88 Copyright Oracle Corporation, 2000. All rights reserved.

FORM_TRIGGER_FAILUREFORM_TRIGGER_FAILUREBEGINBEGIN

--RAISE form_trigger_failure;--

--RAISE form_trigger_failure;--

EXCEPTIONEXCEPTION

--WHEN <exception> THENRAISE form_trigger_failure;--

--WHEN <exception> THENRAISE form_trigger_failure;--

Fail trigger

END;END;

1616--99 Copyright Oracle Corporation, 2000. All rights reserved.

Error TriggersError Triggers

• On-Error:– Fires when a system error message is issued– Is used to trap Form Builder and Oracle Server

errors, and to customize error messages• On-Message:

– Fires when an informative system message is issued

– Is used to suppress or customize specific messages

• On-Error:– Fires when a system error message is issued– Is used to trap Form Builder and Oracle Server

errors, and to customize error messages• On-Message:

– Fires when an informative system message is issued

– Is used to suppress or customize specific messages

1616--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Handling Informative MessagesHandling Informative Messages

• On-Message trigger• Built-in functions:

– MESSAGE_CODE– MESSAGE_TEXT– MESSAGE_TYPE

• On-Message trigger• Built-in functions:

– MESSAGE_CODE– MESSAGE_TEXT– MESSAGE_TYPE

1616--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Alert PropertiesAlert Properties

654

21

3

1616--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Planning AlertsPlanning Alerts

Yes/NoYes/Noquestionsquestions

Yes/No/CancelYes/No/Cancelquestionsquestions

CautionCautionmessagesmessages

InformativeInformativemessagesmessages

1616--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Controlling AlertsControlling Alerts

SET_ALERT_PROPERTYSET_ALERT_PROPERTYSET_ALERT_BUTTON_PROPERTYSET_ALERT_BUTTON_PROPERTY

1616--1414 Copyright Oracle Corporation, 2000. All rights reserved.

SHOW_ALERT FunctionSHOW_ALERT Function

•IF SHOW_ALERT(’del_Check’)=ALERT_BUTTON1 THEN

. . .

•IF SHOW_ALERT(’del_Check’)=ALERT_BUTTON1 THEN

. . .

Alert_Button1Alert_Button1

Alert_Button2Alert_Button2Alert_Button3Alert_Button3

1616--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Directing Errors to an AlertDirecting Errors to an Alert

PROCEDURE Alert_On_Failure IS

n NUMBER;

BEGIN

SET_ALERT_PROPERTY(’error_alert’,

ALERT_MESSAGE_TEXT,ERROR_TYPE||

’-’||TO_CHAR(ERROR_CODE)||

’: ’||ERROR_TEXT);

n := SHOW_ALERT(’error_alert’);

END;

PROCEDURE Alert_On_Failure IS

n NUMBER;

BEGIN

SET_ALERT_PROPERTY(’error_alert’,

ALERT_MESSAGE_TEXT,ERROR_TYPE||

’-’||TO_CHAR(ERROR_CODE)||

’: ’||ERROR_TEXT);

n := SHOW_ALERT(’error_alert’);

END;

1616--1616 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Application and system messages appear on message line.

• Test for built-in failure by using FORM_SUCCESS or other built-in functions.

• Set system variables to suppress system messages: MESSAGE_LEVEL and SUPPRESS_WORKING.

• Application and system messages appear on message line.

• Test for built-in failure by using FORM_SUCCESS or other built-in functions.

• Set system variables to suppress system messages: MESSAGE_LEVEL and SUPPRESS_WORKING.

1616--1717 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• On-Error trigger intercepts system error messages.

• On-Message trigger intercepts system informative messages.

• Alert types: Stop, Caution, and Note• Up to three buttons are available for operator

response.• Display alerts with SHOW_ALERT.• Change alert message with

SET_ALERT_PROPERTY.

• On-Error trigger intercepts system error messages.

• On-Message trigger intercepts system informative messages.

• Alert types: Stop, Caution, and Note• Up to three buttons are available for operator

response.• Display alerts with SHOW_ALERT.• Change alert message with

SET_ALERT_PROPERTY.

1616--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 16 OverviewPractice 16 Overview

This practice covers the following topics:• Using an alert to inform the operator that the

customer must pay cash• Using a generic alert to ask the operator to

confirm that the form should terminate

This practice covers the following topics:• Using an alert to inform the operator that the

customer must pay cash• Using a generic alert to ask the operator to

confirm that the form should terminate

Copyright Oracle Corporation, 2000. All rights reserved.

Query TriggersQuery Triggers

Copyright Oracle Corporation, 2000. All rights reserved.1717--22

ObjectivesObjectives

After completing this lesson, you should be able to do the following: • Explain the processes involved in querying a data

block• Describe query triggers and their scope• Write triggers to supplement query results and

screen query conditions• Control trigger action based on the form query

status

After completing this lesson, you should be able to do the following: • Explain the processes involved in querying a data

block• Describe query triggers and their scope•• Write triggers Write triggers to supplement query results and

screen query conditionsscreen query conditions• Control trigger action based on the form query

status

Copyright Oracle Corporation, 2000. All rights reserved.1717--33

Construct SELECT...Construct SELECT...

Perform queryPerform query

Fetch a row into a new recordFetch a row into a new record

Mark record as validMark record as valid

Fire Post-Query triggerFire Post-Query trigger

Validate any record changesValidate any record changes

Abort queryAbort queryon failureon failure

Query ProcessingQuery Processing

FlushFlushrecordrecord

on failureon failure

Fire Pre-Query triggerFire Pre-Query trigger

Copyright Oracle Corporation, 2000. All rights reserved.1717--44

SELECT Statements IssuedSELECT Statements Issued

SELECT base_column, ..., ROWID

INTO :base_item, ..., :ROWID

FROM base_table

WHERE default_where_clause

AND (example_record_conditions)

AND (query_where_conditions)

ORDER BY default_order_by_clause |

query_where_order_by

SELECT base_column, ..., ROWID

INTO :base_item, ..., :ROWID

FROM base_table

WHERE default_where_clause

AND (example_record_conditions)

AND (query_where_conditions)

ORDER BY default_order_by_clause |

query_where_order_by

Slightly different for COUNTSlightly different for COUNT

Copyright Oracle Corporation, 2000. All rights reserved.1717--55

WHERE ClauseWHERE Clause

• Three sources for the WHERE clause:– WHERE clause block property– Example Record– Query/Where dialog box

• WHERE clauses are combined by the AND operator

• Three sources for the WHERE clause:– WHERE clause block property– Example Record– Query/Where dialog box

• WHERE clauses are combined by the AND operator

Copyright Oracle Corporation, 2000. All rights reserved.1717--66

ORDER BY ClauseORDER BY Clause

• Two sources for the ORDER BY clause:– ORDER BY clause block property– Query/Where dialog box

• Second source for ORDER BY clause overrides the first one

• Two sources for the ORDER BY clause:– ORDER BY clause block property– Query/Where dialog box

• Second source for ORDER BY clause overrides the first one

Copyright Oracle Corporation, 2000. All rights reserved.1717--77

Pre-Query TriggerPre-Query Trigger

IF TO_CHAR(:S_ORD.ID)||

TO_CHAR(:S_ORD.DATE_ORDERED)||

TO_CHAR(:S_ORD.DATE_SHIPPED)

IS NULL THEN

MESSAGE(’You must query by

Order ID or Date’);

RAISE form_trigger_failure;

END IF;

IF TO_CHAR(:S_ORD.ID)||

TO_CHAR(:S_ORD.DATE_ORDERED)||

TO_CHAR(:S_ORD.DATE_SHIPPED)

IS NULL THEN

MESSAGE(’You must query by

Order ID or Date’);

RAISE form_trigger_failure;

END IF;

• Defined at block level• Fires once, before query is performed• Defined at block level• Fires once, before query is performed

Copyright Oracle Corporation, 2000. All rights reserved.1717--88

Post-Query TriggerPost-Query Trigger

SELECT COUNT(ord_id)

INTO :S_ORD.lineitem_count

FROM S_ITEM

WHERE ord_id = :S_ORD.id;

SELECT COUNT(ord_id)

INTO :S_ORD.lineitem_count

FROM S_ITEM

WHERE ord_id = :S_ORD.id;

• Fires for each fetched record (except during array processing)

• Use to populate nondatabase items and calculate statistics

• Fires for each fetched record (except during array processing)

• Use to populate nondatabase items and calculate statistics

Copyright Oracle Corporation, 2000. All rights reserved.1717--99

Using SELECT Statements in TriggersUsing SELECT Statements in Triggers

• Form Builder variables are preceded by a colon.• The query must return one row for success.• Code exception handlers.• The INTO clause is mandatory, with a variable for

each selected column or expression.• ORDER BY is not relevant.

• Form Builder variables are preceded by a colon.• The query must return one row for success.• Code exception handlers.• The INTO clause is mandatory, with a variable for

each selected column or expression.• ORDER BY is not relevant.

Copyright Oracle Corporation, 2000. All rights reserved.1717--1010

Query Array ProcessingQuery Array Processing

• Reduces network traffic• Enables Query Array processing:

– Enable Array Processing option– Set Query Array Size property

• Query Array Size property• Query All Records property

• Reduces network traffic• Enables Query Array processing:

– Enable Array Processing option– Set Query Array Size property

• Query Array Size property• Query All Records property

Copyright Oracle Corporation, 2000. All rights reserved.1717--1111

Coding for ENTER-QUERY Mode

Coding for ENTER-QUERY Mode

• Some triggers may fire in Enter-Query mode.• Set to fire in Enter-Query Mode property.• Test mode during execution with :SYSTEM.MODE

– NORMAL– ENTER-QUERY– QUERY

• Some triggers may fire in Enter-Query mode.• Set to fire in Enter-Query Mode property.• Test mode during execution with :SYSTEM.MODE

– NORMAL– ENTER-QUERY– QUERY

Copyright Oracle Corporation, 2000. All rights reserved.1717--1212

Coding for ENTER-QUERY Mode

Coding for ENTER-QUERY Mode

• Example

• Some built-ins are illegal.• Consult online Help.• You cannot navigate to another record in the

current form.

• Example

• Some built-ins are illegal.• Consult online Help.• You cannot navigate to another record in the

current form.

IF :SYSTEM.MODE = ’NORMAL’

THEN ENTER_QUERY;

ELSE EXECUTE_QUERY;

END IF;

IF :SYSTEM.MODE = ’NORMAL’

THEN ENTER_QUERY;

ELSE EXECUTE_QUERY;

END IF;

Copyright Oracle Corporation, 2000. All rights reserved.1717--1313

Overriding Default Query ProcessingOverriding Default Query Processing

Do-the-Right-Thing Built-in

COUNT_QUERY

FETCH_RECORDS

SELECT_RECORDS

Trigger

On-Close

On-Count

On-Fetch

Pre-Select

On-Select

Post-Select

Copyright Oracle Corporation, 2000. All rights reserved.1717--1414

Overriding Default Query ProcessingOverriding Default Query Processing

• On-Fetch continues to fire until:– It fires without executing

CREATE_QUERIED_RECORD.– The query is closed by the user or by

ABORT_QUERY.– It raises FORM_TRIGGER_FAILURE.

• On-Select replaces open cursor, parse, and execute phases.

• On-Fetch continues to fire until:– It fires without executing

CREATE_QUERIED_RECORD.– The query is closed by the user or by

ABORT_QUERY.– It raises FORM_TRIGGER_FAILURE.

• On-Select replaces open cursor, parse, and execute phases.

Copyright Oracle Corporation, 2000. All rights reserved.1717--1515

Obtaining Query Information at Run TimeObtaining Query Information at Run Time

• SYSTEM.MODE• SYSTEM.LAST_QUERY

– Contains bind variables (ORD_ID = :1) before SELECT_RECORDS

– Contains actual values (ORD_ID = 102) after SELECT_RECORDS

• SYSTEM.MODE• SYSTEM.LAST_QUERY

– Contains bind variables (ORD_ID = :1) before SELECT_RECORDS

– Contains actual values (ORD_ID = 102) after SELECT_RECORDS

Copyright Oracle Corporation, 2000. All rights reserved.1717--1616

Obtaining Query Information at Run TimeObtaining Query Information at Run Time

• GET_BLOCK_PROPERTY SET_BLOCK_PROPERTY– Get and set:

DEFAULT_WHEREORDER_BYQUERY_ALLOWEDQUERY_HITS

– Get only:QUERY_OPTIONSRECORDS_TO_FETCH

• GET_BLOCK_PROPERTY SET_BLOCK_PROPERTY– Get and set:

DEFAULT_WHEREORDER_BYQUERY_ALLOWEDQUERY_HITS

– Get only:QUERY_OPTIONSRECORDS_TO_FETCH

Copyright Oracle Corporation, 2000. All rights reserved.1717--1717

Obtaining Query Information at Run TimeObtaining Query Information at Run Time

• GET_ITEM_PROPERTY SET_ITEM_PROPERTY– Get and set:

CASE_INSENSITIVE_QUERYQUERYABLEQUERY_ONLY

– Get only:QUERY_LENGTH

• GET_ITEM_PROPERTY SET_ITEM_PROPERTY– Get and set:

CASE_INSENSITIVE_QUERYQUERYABLEQUERY_ONLY

– Get only:QUERY_LENGTH

Copyright Oracle Corporation, 2000. All rights reserved.1717--1818

SummarySummary

• A Pre-Query trigger fires before a query executes. Use it to check or modify query conditions.

• A Post-Query trigger fires as each record is fetched (except array processing). Use it to perform calculations and populate additional items.

• A Pre-Query trigger fires before a query executes. Use it to check or modify query conditions.

• A Post-Query trigger fires as each record is fetched (except array processing). Use it to perform calculations and populate additional items.

Copyright Oracle Corporation, 2000. All rights reserved.1717--1919

SummarySummary

• Some triggers can fire in both Normal and Enter Query modes:– Test the current mode with SYSTEM.MODE.– Some built-ins are illegal in Enter Query mode.

• Obtain query information at run time:– SYSTEM.MODE – SYSTEM.LAST_QUERY

• Some triggers can fire in both Normal and Enter Query modes:– Test the current mode with SYSTEM.MODE.– Some built-ins are illegal in Enter Query mode.

• Obtain query information at run time:– SYSTEM.MODE – SYSTEM.LAST_QUERY

Copyright Oracle Corporation, 2000. All rights reserved.1717--2020

Practice 17 OverviewPractice 17 Overview

This practice covers the following topics:• Populating customer names and sales

representative names for each row of the S_ORD block

• Populating descriptions for each row of the S_ITEM block

• Disabling the effect of the Exit button in Enter Query mode

• Adding two check boxes to enable case-sensitive and exact match query

This practice covers the following topics:• Populating customer names and sales

representative names for each row of the S_ORD block

• Populating descriptions for each row of the S_ITEM block

• Disabling the effect of the Exit button in Enter Query mode

• Adding two check boxes to enable case-sensitive and exact match query

Copyright Oracle Corporation, 2000. All rights reserved.

ValidationValidation

1818--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following: • Explain the effects of the validation unit upon a

form• List Form Builder validation properties• Control validation by using triggers

After completing this lesson, you should be able to do the following: • Explain the effects of the validation unit upon a

form• List Form Builder validation properties• Control validation by using triggers

1818--33 Copyright Oracle Corporation, 2000. All rights reserved.

ValidationValidation

• Form Builder validates at the following levels:• Form Builder validates at the following levels:

Form level

Block level

Record level Item level

1818--44 Copyright Oracle Corporation, 2000. All rights reserved.

ValidationValidation

• Validation occurs when:– [Enter] key or ENTER Built-in is

obeyed– Operator or trigger leaves the validation unit

(includes a Commit)

• Validation occurs when:– [Enter] key or ENTER Built-in is

obeyed– Operator or trigger leaves the validation unit

(includes a Commit)

1818--55 Copyright Oracle Corporation, 2000. All rights reserved.

Validation Unit PropertyValidation Unit Property

1818--66 Copyright Oracle Corporation, 2000. All rights reserved.

LOV for ValidationLOV for Validation

LOVTERRY

Full listFull list

MARTPartial listPartial list

WARDValidValid

Auto Auto completecomplete

AL

ALAN

HDATE---------------

20-FEB-198122-FEB-198106-MAR-199606-FEB-1995

08-SEP-1981

ENAME---------------

MARTIN MARTINEZSEDATWARD

ALAN

1818--77 Copyright Oracle Corporation, 2000. All rights reserved.

Validation TriggersValidation Triggers

IF :S_ORD.date_shipped < :S_ORD.date_ordered THEN

MESSAGE(’Ship Date is before Order Date!’);

RAISE form_trigger_failure;

END IF;

IF :S_ORD.date_shipped < :S_ORD.date_ordered THEN

MESSAGE(’Ship Date is before Order Date!’);

RAISE form_trigger_failure;

END IF;

• Item levelWhen-Validate-Item

• Block levelWhen-Validate-Record

• Item levelWhen-Validate-Item

• Block levelWhen-Validate-Record

1818--88 Copyright Oracle Corporation, 2000. All rights reserved.

Validating User InputValidating User Input

Trigger failure?Trigger failure?

WW--VV--II

Customer IDCustomer ID

998

SELECT . . .

WHERE id = :S_ORD.customer_id

SELECT . . .

WHERE id = :S_ORD.customer_id

1818--99 Copyright Oracle Corporation, 2000. All rights reserved.

Tracking Validation StatusTracking 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

• 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

1818--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Tracking Validation StatusTracking Validation Status

• VALID– When validation has been successful– After records are fetched from database– After a successful post or commit– Duplicated record inherits status of source

• VALID– When validation has been successful– After records are fetched from database– After a successful post or commit– Duplicated record inherits status of source

1818--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Built-ins for ValidationBuilt-ins for Validation

• CLEAR_BLOCK, CLEAR_ FORM, EXIT_FORM• ENTER• SET_FORM_PROPERTY

– (..., VALIDATION)– (..., VALIDATION_UNIT)

• ITEM_IS_VALID item property• VALIDATE (VALIDATION_ UNIT)

• CLEAR_BLOCK, CLEAR_ FORM, EXIT_FORM• ENTER• SET_FORM_PROPERTY

– (..., VALIDATION)– (..., VALIDATION_UNIT)

• ITEM_IS_VALID item property• VALIDATE (VALIDATION_ UNIT)

1818--1212 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Validation occurs at item, record, block, and form levels.

• Validation happens when:– [Enter] Key or ENTER built-in is activated– Control leaves the validation unit due to

navigation or commit

• Validation occurs at item, record, block, and form levels.

• Validation happens when:– [Enter] Key or ENTER built-in is activated– Control leaves the validation unit due to

navigation or commit

1818--1313 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Standard validation occurs before trigger validation.

• Default validation unit is item level.• Validation status

– NEW– CHANGED– VALID

• When-Validate-“object” triggers to supplement validation.

• Standard validation occurs before trigger validation.

• Default validation unit is item level.• Validation status

– NEW– CHANGED– VALID

• When-Validate-“object” triggers to supplement validation.

1818--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 18 OverviewPractice 18 Overview

This practice covers the following topics:• Validating the Sales Representative item value by

using an LOV• Writing a validation trigger to check that the

shipped date is not before the ordered date• Populating customer names, sales representative

names, and IDs when a customer ID is changed• Writing a validation trigger to populate the name

and the price of the product when the product ID is changed

This practice covers the following topics:• Validating the Sales Representative item value by

using an LOV• Writing a validation trigger to check that the

shipped date is not before the ordered date• Populating customer names, sales representative

names, and IDs when a customer ID is changed• Writing a validation trigger to populate the name

and the price of the product when the product ID is changed

Copyright Oracle Corporation, 2000. All rights reserved.

NavigationNavigation

1919--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following: • Distinguish between internal and external

navigation• Describe and use navigation triggers• Identify built-ins that cause navigation

After completing this lesson, you should be able to do the following: • Distinguish between internal and external

navigation• Describe and use navigation triggers• Identify built-ins that cause navigation

1919--33 Copyright Oracle Corporation, 2000. All rights reserved.

About NavigationAbout Navigation

• What is the navigational unit?– Outside the form– Form– Block– Record– Item

• Entering and leaving objects• What happens if navigation fails?

• What is the navigational unit?– Outside the form– Form– Block– Record– Item

• Entering and leaving objects• What happens if navigation fails?

1919--44 Copyright Oracle Corporation, 2000. All rights reserved.

Navigation PropertiesNavigation Properties

• Form module– Mouse navigation limit– First navigation data block

• Block– Navigation style– Previous navigation data block– Next navigation data block

• Form module– Mouse navigation limit– First navigation data block

• Block– Navigation style– Previous navigation data block– Next navigation data block

1919--55 Copyright Oracle Corporation, 2000. All rights reserved.

Navigation PropertiesNavigation Properties

• Item– Enabled– Keyboard navigable– Mouse navigate – Previous navigation item– Next navigation item

• Item– Enabled– Keyboard navigable– Mouse navigate – Previous navigation item– Next navigation item

1919--66 Copyright Oracle Corporation, 2000. All rights reserved.

v

^

Mouse Navigate Property = YesMouse Navigate Property = YesMouse Navigate Property = Yes

x

Exit item

Exit record

Exit block

Enter block

Enter record

Enter item

1919--77 Copyright Oracle Corporation, 2000. All rights reserved.

v

^x

Internal NavigationInternal NavigationInternal Navigation

Next Record

Exit item

Exit record

Enter record

Enter item

1919--88 Copyright Oracle Corporation, 2000. All rights reserved.

v

^x

Navigation TriggersNavigation Triggers

Pre- and Post-

When-New-“object”-Instance

1919--99 Copyright Oracle Corporation, 2000. All rights reserved.

Navigation TriggersNavigation 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

1919--1010 Copyright Oracle Corporation, 2000. All rights reserved.

When-New-“object”-Instance TriggersWhen-New-“object”-Instance Triggers

• When-New-Form-Instance• When-New-Block-Instance• When-New-Record-Instance• When-New-Item-Instance

• When-New-Form-Instance• When-New-Block-Instance• When-New-Record-Instance• When-New-Item-Instance

1919--1111 Copyright Oracle Corporation, 2000. All rights reserved.

SET_“object”_PROPERTY ExamplesSET_SET_“object”“object”_PROPERTY Examples_PROPERTY Examples

SET_FORM_PROPERTY(FIRST_NAVIGATION_BLOCK, ’S_ITEM’);SET_FORM_PROPERTY(FIRST_NAVIGATION_BLOCK, ’S_ITEM’);

SET_BLOCK_PROPERTY(’S_ORD’, ORDER_BY,

’CUSTOMER_ID’);

SET_BLOCK_PROPERTY(’S_ORD’, ORDER_BY,

’CUSTOMER_ID’);

SET_RECORD_PROPERTY(3, ’S_ITEM’, STATUS,

QUERY_STATUS);

SET_RECORD_PROPERTY(3, ’S_ITEM’, STATUS,

QUERY_STATUS);

SET_ITEM_PROPERTY(’CONTROL.stock_button’, ICON_NAME,

’stock’);

SET_ITEM_PROPERTY(’CONTROL.stock_button’, ICON_NAME,

’stock’);

1919--1212 Copyright Oracle Corporation, 2000. All rights reserved.

The Pre- and Post-TriggersThe Pre- and Post-Triggers

• Pre/Post-Form • Pre/Post-Block • Pre/Post-Record• Pre/Post-Text-Item

• Pre/Post-Form • Pre/Post-Block • Pre/Post-Record• Pre/Post-Text-Item

1919--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Post-Block Trigger ExamplePost-Block Trigger Example

SET_ITEM_PROPERTY(’CONTROL.stock_button’, enabled,

property_false);

SET_ITEM_PROPERTY(’CONTROL.stock_button’, enabled,

property_false);

Disabling Stock_Button when leaving the S_ITEM block:Disabling Stock_Button when leaving the S_ITEM block:

1919--1414 Copyright Oracle Corporation, 2000. All rights reserved.

v

^

The Navigation TrapThe Navigation Trap

A Post-Text-Item

Pre-Text-Item

Pre-Text-Item

B

1919--1515 Copyright Oracle Corporation, 2000. All rights reserved.

• When-New-Item-Instance

• Pre-Text-Item

• When-New-Item-Instance

• Pre-Text-Item

IF CHECKBOX_CHECKED(’S_ORD.order_filled’)THEN

SET_ITEM_PROPERTY(’S_ORD.date_shipped’,

UPDATE_ALLOWED, property_false);

END IF;

IF CHECKBOX_CHECKED(’S_ORD.order_filled’)THEN

SET_ITEM_PROPERTY(’S_ORD.date_shipped’,

UPDATE_ALLOWED, property_false);

END IF;

Navigation in TriggersNavigation in Triggers

IF CHECKBOX_CHECKED(’S_ORD.order_filled’) THEN

SET_ITEM_PROPERTY(’S_ORD.date_shipped’,

UPDATE_ALLOWED, property_false);

END IF;

IF CHECKBOX_CHECKED(’S_ORD.order_filled’) THEN

SET_ITEM_PROPERTY(’S_ORD.date_shipped’,

UPDATE_ALLOWED, property_false);

END IF;

GO_ITEM(’S_ORD.date_shipped’);

GO_ITEM(’S_ORD.date_shipped’);

1919--1616 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Controlling navigation through properties• Internal navigation• Navigation triggers

– When-New-“object”-Instance– Pre-– Post-

• Navigation trap• Navigation in triggers

• Controlling navigation through properties• Internal navigation• Navigation triggers

– When-New-“object”-Instance– Pre-– Post-

• Navigation trap• Navigation in triggers

1919--1717 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 19 OverviewPractice 19 Overview

This practice covers the following topics:• Executing a query at form startup• Populating product images when cursor arrives on

each record of the S_ITEM block

This practice covers the following topics:• Executing a query at form startup• Populating product images when cursor arrives on

each record of the S_ITEM block

Copyright Oracle Corporation, 2000. All rights reserved.

Transaction ProcessingTransaction Processing

2020--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following: • Describe details of commit processing and commit

triggers • Supplement transaction processing by using

triggers• Allocate sequence numbers to records as they are

applied to tables• Implement array DML

After completing this lesson, you should be able to do the following: • Describe details of commit processing and commit

triggers • Supplement transaction processing by using

triggers• Allocate sequence numbers to records as they are

applied to tables• Implement array DML

2020--33 Copyright Oracle Corporation, 2000. All rights reserved.

Transaction ProcessingTransaction Processing

SaveTransaction (Begin)Transaction (Begin)

FORM AAction Edit

Block#1

Block#2

New RecordUpdated Record

Deleted RecordUpdated Record

Commit work;Commit work;

INSERT INTO Table1INSERT INTO Table1

UPDATE Table1UPDATE Table1

DELETE FROM Table2DELETE FROM Table2

UPDATE Table2UPDATE Table2

Transaction (End)Transaction (End)

2020--44 Copyright Oracle Corporation, 2000. All rights reserved.

Transaction ProcessingTransaction Processing

Transaction processing includes two phases:• Post:

– Writes record changes to base tables– Fires transactional triggers

• Commit: Performs database commitErrors result in:• Rollback of the database changes• Error message

Transaction processing includes two phases:• Post:

– Writes record changes to base tables– Fires transactional triggers

• Commit: Performs database commitErrors result in:• Rollback of the database changes• Error message

2020--55 Copyright Oracle Corporation, 2000. All rights reserved.

1

The Commit Sequence of EventsThe Commit Sequence of EventsValidate the form

Validate the block

Pre-Commit

Pre-Delete

On-Delete Delete row

Post-Delete

2

More More records?records?

2020--66 Copyright Oracle Corporation, 2000. All rights reserved.

The Commit Sequence of EventsThe Commit Sequence of Events

Check uniquenessCheck uniqueness

Pre-Insert

Copy value from item

Pre-Update

On-Insert Insert row

Post-Insert

On-Update Update row

Post-Update

MoreMoreblocks?blocks?

Post-Database-Commit

Post-Forms-Commit

1INSERT UPDATE

Stop

2

Commit changes

More More records?records?

2020--77 Copyright Oracle Corporation, 2000. All rights reserved.

Characteristics of Commit Triggers

Characteristics of Commit Triggers

• Pre-Commit: Fires once if form changes are made or uncommitted changes are posted

• Pre- and Post-DML• On-DML: Fires per record, replacing default DML

on rowUse DELETE_RECORD, INSERT_RECORD, UPDATE_RECORD built-ins

• Pre-Commit: Fires once if form changes are made or uncommitted changes are posted

• Pre- and Post-DML• On-DML: Fires per record, replacing default DML

on rowUse DELETE_RECORD, INSERT_RECORD, UPDATE_RECORD built-ins

2020--88 Copyright Oracle Corporation, 2000. All rights reserved.

Characteristics of Commit Triggers

Characteristics of Commit Triggers

• Post-Forms-Commit: Fires once even if no changes are made

• Post-Database-Commit: Fires once even if no changes are made

Note: A commit-trigger failure causes a rollback to the savepoint.

• Post-Forms-Commit: Fires once even if no changes are made

•• PostPost--DatabaseDatabase--Commit: Fires once even if no Commit: Fires once even if no changes are madechanges are made

Note: A commit-trigger failure causes a rollback to the savepoint.

2020--99 Copyright Oracle Corporation, 2000. All rights reserved.

Commit Triggers UsesCommit Triggers Uses

Pre-Commit

Pre-Delete

Pre-Insert

Pre-Update

Check user authorization; set up special locking

Journaling; implement foreign-key delete rule

Generate sequence numbers; journaling; automatically generated columns; check constraints

Journaling; implement foreign-key update rule; auto-generated columns; check constraints

2020--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Commit Triggers Uses Commit Triggers Uses

On-Insert/Update/Delete

Post-Forms-Commit

Post-Database-Commit

Replace default blockDML statements

Check complex multirow constraints

Test commit success;test uncommitted posts

2020--1111 Copyright Oracle Corporation, 2000. All rights reserved.

ColumnColumnItemItemLife of an UpdateLife of an Update

QueryRollbackRollback

DataData20 20

LockedLockedQuery

30 20Update record in form

[Save] 30 20[Save]

Pre-Update 30 20Pre-Update

Row Updated 30 30 20Row updated

Post-Update 30 30 20Post-Update

Commit 30 30

2020--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Delete ValidationDelete Validation

DECLARE

CURSOR C1 IS

SELECT ’anything’ FROM S_ORD

WHERE customer_id = :S_CUSTOMER.id;

BEGIN

OPEN C1;

FETCH C1 INTO :GLOBAL.dummy;

IF C1%FOUND THEN

CLOSE C1;

MESSAGE(’There are orders for this customer!’);

RAISE form_trigger_failure;

ELSE

CLOSE C1;

END IF;

END;

DECLARE

CURSOR C1 IS

SELECT ’anything’ FROM S_ORD

WHERE customer_id = :S_CUSTOMER.id;

BEGIN

OPEN C1;

FETCH C1 INTO :GLOBAL.dummy;

IF C1%FOUND THEN

CLOSE C1;

MESSAGE(’There are orders for this customer!’);

RAISE form_trigger_failure;

ELSE

CLOSE C1;

END IF;

END;

• Pre-Delete trigger• Final checks before row deletion• Pre-Delete trigger• Final checks before row deletion

2020--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Assigning Sequence NumbersAssigning Sequence Numbers

PrePre--InsertInsertInsertInsert

601

602

602

DatabaseDatabase

601 Value Value

IDID

SequenceSequence

SELECT S_ORD_ID.nextval

INTO :S_ORD.id

FROM SYS.dual;

SELECT S_ORD_ID.nextval

INTO :S_ORD.id

FROM SYS.dual;

2020--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Keeping an Audit TrailKeeping an Audit Trail

:GLOBAL.insert_tot :=

TO_CHAR(TO_NUMBER(:GLOBAL.insert_tot)+1);

:GLOBAL.insert_tot :=

TO_CHAR(TO_NUMBER(:GLOBAL.insert_tot)+1);

• Write changes to nonbase tables.• Gather statistics on applied changes.

Post-Insert example:

• Write changes to nonbase tables.• Gather statistics on applied changes.

Post-Insert example:

2020--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Testing the Resultof Trigger DML

Testing the Resultof Trigger DML

• SQL%FOUND• SQL%NOTFOUND• SQL%ROWCOUNT

• SQL%FOUND• SQL%NOTFOUND• SQL%ROWCOUNT

UPDATE S_ORD

SET date_shipped = SYSDATE

WHERE id = :S_ORD.id;

IF SQL%NOTFOUND THEN

MESSAGE(’Record not found in database’);

RAISE form_trigger_failure;

END IF;

UPDATE S_ORD

SET date_shipped = SYSDATE

WHERE id = :S_ORD.id;

IF SQL%NOTFOUND THEN

MESSAGE(’Record not found in database’);

RAISE form_trigger_failure;

END IF;

2020--1616 Copyright Oracle Corporation, 2000. All rights reserved.

DML Statements Issued During Commit Processing

DML Statements Issued During Commit Processing

INSERT INTO base_table (base_column, base_column,...)

VALUES (:base_item, :base_item, ...)

UPDATE base_table

SET base_column = :base_item, base_column =

:base_item, ...

WHERE ROWID = :ROWID

DELETE FROM base_table

WHERE ROWID = :ROWID

2020--1717 Copyright Oracle Corporation, 2000. All rights reserved.

DML Statements Issued During Commit Processing

DML Statements Issued During Commit Processing

Rules:• DML statements may fire database triggers.• Form Builder uses and retrieves ROWID.• The Update Changed Columns Only and Enforce

Column Security properties affect UPDATE statements.

• Locking statements are not issued.

Rules:• DML statements may fire database triggers.• Form Builder uses and retrieves ROWID.• The Update Changed Columns Only and Enforce

Column Security properties affect UPDATE statements.

• Locking statements are not issued.

2020--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Overriding Default TransactionOverriding Default Transaction

Additional transactional triggers:Additional transactional triggers:

On-Check-Unique

On-Column-Security

On-Commit

On-Rollback

On-Savepoint

On-Sequence-Number

CHECK_RECORD_UNIQUENESS

ENFORCE_COLUMN_SECURITY

COMMIT_FORM

ISSUE_ROLLBACK

ISSUE_SAVEPOINT

GENERATE_SEQUENCE_NUMBER

Trigger Do-the-Right-Thing Built-in

2020--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Overriding Default TransactionOverriding Default Transaction

Transactional triggers for logging on and off:Transactional triggers for logging on and off:

Pre-Logon

Pre-Logout

On-Logon

On-Logout

Post-Logon

Post-Logout

-

-

LOGON

LOGOUT

-

-

Trigger Do-the-Right-Thing Built-in

2020--2020 Copyright Oracle Corporation, 2000. All rights reserved.

Running with Data SourcesOther than Oracle

Running with Data SourcesOther than Oracle

• Three ways to run against data sources other than Oracle:– Oracle Open Gateways– Oracle Open Client Adapter for ODBC– Write appropriate transactional triggers

• Three ways to run against data sources other than Oracle:– Oracle Open Gateways– Oracle Open Client Adapter for ODBC– Write appropriate transactional triggers

2020--2121 Copyright Oracle Corporation, 2000. All rights reserved.

Running with Data SourcesOther than Oracle

Running with Data SourcesOther than Oracle

• Connecting with Open Gateway:– Cursor and Savepoint mode form module

properties– Key mode and Locking mode block properties

• Using transactional triggers:– Call 3GL programs– Database data block property

• Connecting with Open Gateway:– Cursor and Savepoint mode form module

properties– Key mode and Locking mode block properties

• Using transactional triggers:– Call 3GL programs– Database data block property

2020--2222 Copyright Oracle Corporation, 2000. All rights reserved.

Getting and Setting the Commit Status

Getting and Setting the Commit Status

• What is commit status?• SYSTEM.RECORD_STATUS:

– NEW– INSERT (also caused by control items)– QUERY– CHANGED

• What is commit status?• SYSTEM.RECORD_STATUS:

– NEW– INSERT (also caused by control items)– QUERY– CHANGED

2020--2323 Copyright Oracle Corporation, 2000. All rights reserved.

Getting and Setting the Commit Status

Getting and Setting the Commit Status

• SYSTEM.BLOCK_STATUS:– NEW (may contain records with status

INSERT)– QUERY (also possible for control block)– CHANGED (block will be committed)

• SYSTEM.BLOCK_STATUS:– NEW (may contain records with status

INSERT)– QUERY (also possible for control block)– CHANGED (block will be committed)

2020--2424 Copyright Oracle Corporation, 2000. All rights reserved.

Getting and Setting the Commit Status

Getting and Setting the Commit Status

• SYSTEM.FORM_STATUS:– NEW– QUERY– CHANGED

• SYSTEM.FORM_STATUS:– NEW– QUERY– CHANGED

2020--2525 Copyright Oracle Corporation, 2000. All rights reserved.

Getting and Setting the Commit Status

Getting and Setting the Commit Status

• System variables versus built-ins for commit status

• Built-ins for getting and setting commit status:– GET_BLOCK_PROPERTY– GET_RECORD_PROPERTY– SET_ RECORD _PROPERTY

• System variables versus built-ins for commit status

• Built-ins for getting and setting commit status:– GET_BLOCK_PROPERTY– GET_RECORD_PROPERTY– SET_ RECORD _PROPERTY

2020--2626 Copyright Oracle Corporation, 2000. All rights reserved.

Getting and Setting the Commit Status

Getting and Setting the Commit Status

• Example: If the third record of block S_ORD is a changed database record, set the status back to QUERY.

• Warnings:– Do not confuse commit status with validation

status.– The commit status is updated during

validation.

• Example: If the third record of block S_ORD is a changed database record, set the status back to QUERY.

• Warnings:– Do not confuse commit status with validation

status.– The commit status is updated during

validation.

2020--2727 Copyright Oracle Corporation, 2000. All rights reserved.

Array DMLArray DML

• Performs array inserts, updates, and deletes• Vastly reduces network traffic• Performs array inserts, updates, and deletes• Vastly reduces network traffic

Fewer round trips Fewer round trips (exact number depends(exact number depends

on array size)on array size)2 inserts2 inserts

2 updates2 updates

1 delete1 deleteDatabaseDatabase

Empno Ename Job Hiredate

1234 Jones Clerk 01-Jan-19951235 Smith Clerk 01-Jan-1995

1236 Adams Clerk 01-Jan-19951237 Clark Clerk 01-Jan-1995

2020--2828 Copyright Oracle Corporation, 2000. All rights reserved.

Effect of Array DML on Transactional Triggers

Effect of Array DML on Transactional Triggers

Array DML Size = 1Array DML Size = 1 Array DML Size > 1Array DML Size > 1

FiresFiresFires for each Fires for each insert, update,insert, update,deletedelete

Fires for each Fires for each insert, update, insert, update, deletedelete

RepeatedRepeatedfor eachfor eachinsert,insert,update,update,deletedelete

POSTPOST--

PREPRE--

DML

FiresFires

DML

POSTPOST--

PREPRE--

2020--2929 Copyright Oracle Corporation, 2000. All rights reserved.

Implementing Array DMLImplementing Array DML

1. Enable the Array Processing option.2. Specify a DML Array Size of greater than 1.3. Specify block primary keys.

1. Enable the Array Processing option.2. Specify a DML Array Size of greater than 1.3. Specify block primary keys.

2020--3030 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Post and commit phases• Flow of commit processing• DML statements issued during commit

processing• Characteristics and common uses of commit

triggers• Overriding default transaction processing• Getting and setting the commit status• Implementing Array DML

• Post and commit phases• Flow of commit processing• DML statements issued during commit

processing• Characteristics and common uses of commit

triggers• Overriding default transaction processing• Getting and setting the commit status• Implementing Array DML

2020--3131 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 20 OverviewPractice 20 Overview

This practice covers the following topics:• Automatically populating order IDs by using a

sequence• Automatically populating item IDs by adding the

current highest order ID• Customizing the commit messages in the

CUSTOMERS form• Customizing the login screen in the CUSTOMERS

form

This practice covers the following topics:• Automatically populating order IDs by using a

sequence• Automatically populating item IDs by adding the

current highest order ID• Customizing the commit messages in the

CUSTOMERS form• Customizing the login screen in the CUSTOMERS

form

Copyright Oracle Corporation, 2000. All rights reserved.

Writing Flexible CodeWriting Flexible Code

2121--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following: • Describe flexible code• State the advantages of using system variables• Identify built-in subprograms that assist flexible

coding• Write code to reference objects by internal ID• Write code to reference objects indirectly

After completing this lesson, you should be able to do the following: • Describe flexible code• State the advantages of using system variables• Identify built-in subprograms that assist flexible

coding• Write code to reference objects by internal ID• Write code to reference objects indirectly

2121--33 Copyright Oracle Corporation, 2000. All rights reserved.

Flexible CodeFlexible Code

• Is reusable code• Is generic code• Avoids hard-coded object names• Makes maintenance easier• Increases productivity

• Is reusable code• Is generic code• Avoids hard-coded object names• Makes maintenance easier• Increases productivity

2121--44 Copyright Oracle Corporation, 2000. All rights reserved.

System Variables for Current ContextSystem Variables for Current Context

• Input focus:– SYSTEM.CURSOR_BLOCK– SYSTEM.CURSOR_RECORD– SYSTEM.CURSOR_ITEM– SYSTEM.CURSOR_VALUE

• Input focus:– SYSTEM.CURSOR_BLOCK– SYSTEM.CURSOR_RECORD– SYSTEM.CURSOR_ITEM– SYSTEM.CURSOR_VALUE

2121--55 Copyright Oracle Corporation, 2000. All rights reserved.

System Variables for Current ContextSystem Variables for Current Context

• Trigger focus:– SYSTEM.TRIGGER_BLOCK– SYSTEM.TRIGGER_RECORD– SYSTEM.TRIGGER_ITEM

• Trigger focus:– SYSTEM.TRIGGER_BLOCK– SYSTEM.TRIGGER_RECORD– SYSTEM.TRIGGER_ITEM

2121--66 Copyright Oracle Corporation, 2000. All rights reserved.

System Status VariablesSystem Status Variables

ENTER;

IF :SYSTEM.BLOCK_STATUS = ’CHANGED’ THEN

COMMIT_FORM;

END IF;

CLEAR_BLOCK;

ENTER;

IF :SYSTEM.BLOCK_STATUS = ’CHANGED’ THEN

COMMIT_FORM;

END IF;

CLEAR_BLOCK;

IF :SYSTEM.CURSOR_BLOCK = ’S_ORD’ THEN

GO_BLOCK(’S_ITEM’);

ELSIF :SYSTEM.CURSOR_BLOCK = ’S_ITEM’ THEN

GO_BLOCK(’S_INVENTORY’);

ELSIF :SYSTEM.CURSOR_BLOCK =’S_INVENTORY’ THEN

GO_BLOCK(’S_ORD’);

END IF;

IF :SYSTEM.CURSOR_BLOCK = ’S_ORD’ THEN

GO_BLOCK(’S_ITEM’);

ELSIF :SYSTEM.CURSOR_BLOCK = ’S_ITEM’ THEN

GO_BLOCK(’S_INVENTORY’);

ELSIF :SYSTEM.CURSOR_BLOCK =’S_INVENTORY’ THEN

GO_BLOCK(’S_ORD’);

END IF;

WhenWhen--ButtonButton--PressedPressed

2121--77 Copyright Oracle Corporation, 2000. All rights reserved.

GET_object_PROPERTY Built-Ins

GET_object_PROPERTY Built-Ins

• GET_APPLICATION_PROPERTY• GET_FORM_PROPERTY• GET_BLOCK_PROPERTY• GET_RELATION_PROPERTY • GET_RECORD_PROPERTY• GET_ITEM_PROPERTY• GET_ITEM_INSTANCE_PROPERTY

• GET_APPLICATION_PROPERTY• GET_FORM_PROPERTY• GET_BLOCK_PROPERTY• GET_RELATION_PROPERTY • GET_RECORD_PROPERTY• GET_ITEM_PROPERTY• GET_ITEM_INSTANCE_PROPERTY

2121--88 Copyright Oracle Corporation, 2000. All rights reserved.

GET_object_PROPERTY Built-Ins

GET_object_PROPERTY Built-Ins

• GET_LOV_PROPERTY• GET_RADIO_BUTTON_PROPERTY• GET_MENU_ITEM_PROPERTY• GET_CANVAS_PROPERTY • GET_TAB_PAGE_PROPERTY• GET_VIEW_PROPERTY• GET_WINDOW_PROPERTY

• GET_LOV_PROPERTY• GET_RADIO_BUTTON_PROPERTY• GET_MENU_ITEM_PROPERTY• GET_CANVAS_PROPERTY • GET_TAB_PAGE_PROPERTY• GET_VIEW_PROPERTY• GET_WINDOW_PROPERTY

2121--99 Copyright Oracle Corporation, 2000. All rights reserved.

SET_object_PROPERTY Built-Ins

SET_object_PROPERTY Built-Ins

• SET_APPLICATION_PROPERTY• SET_FORM_PROPERTY• SET_BLOCK_PROPERTY• SET_RELATION_PROPERTY • SET_RECORD_PROPERTY• SET_ITEM_PROPERTY• SET_ITEM_INSTANCE_PROPERTY

• SET_APPLICATION_PROPERTY• SET_FORM_PROPERTY• SET_BLOCK_PROPERTY• SET_RELATION_PROPERTY • SET_RECORD_PROPERTY• SET_ITEM_PROPERTY• SET_ITEM_INSTANCE_PROPERTY

2121--1010 Copyright Oracle Corporation, 2000. All rights reserved.

SET_object_PROPERTY Built-Ins

SET_object_PROPERTY Built-Ins

• SET_LOV_PROPERTY• SET_RADIO_BUTTON_PROPERTY• SET_MENU_ITEM_PROPERTY• SET_CANVAS_PROPERTY • SET_TAB_PAGE_PROPERTY• SET_VIEW_PROPERTY• SET_WINDOW_PROPERTY

• SET_LOV_PROPERTY• SET_RADIO_BUTTON_PROPERTY• SET_MENU_ITEM_PROPERTY• SET_CANVAS_PROPERTY • SET_TAB_PAGE_PROPERTY• SET_VIEW_PROPERTY• SET_WINDOW_PROPERTY

2121--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Object IDsObject IDs

ID

lov_id := FIND_LOV(’my_lov’)lov_id := FIND_LOV(’my_lov’)

...SHOW_LOV(lov_id)...SHOW_LOV(lov_id)

ID

...SHOW_LOV(’my_lov’)...SHOW_LOV(’my_lov’)

Finding the object ID:Finding the object ID:

Referencing an object by ID:Referencing an object by ID:

Referencing an object by name:Referencing an object by name:

2121--1212 Copyright Oracle Corporation, 2000. All rights reserved.

FIND_ Built-InsFIND_ Built-Ins

• FIND_FORM • FIND_BLOCK • FIND_ITEM • FIND_RELATION • FIND_LOV

• FIND_FORM • FIND_BLOCK • FIND_ITEM • FIND_RELATION • FIND_LOV

ID

2121--1313 Copyright Oracle Corporation, 2000. All rights reserved.

FIND_ Built-InsFIND_ Built-Ins

• FIND_WINDOW• FIND_VIEW • FIND_CANVAS• FIND_ALERT• FIND_EDITOR

• FIND_WINDOW• FIND_VIEW • FIND_CANVAS• FIND_ALERT• FIND_EDITOR

ID

2121--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Using Object IDsUsing Object IDs

• Declare a PL/SQL variable of the same data type.• Use the variable for any later reference to the

object.• Use the variable within the current PL/SQL block

only.

• Declare a PL/SQL variable of the same data type.• Use the variable for any later reference to the

object.• Use the variable within the current PL/SQL block

only.

2121--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Using Object IDsUsing Object IDs

Example:Example:

DECLARE

item_var item;

BEGIN

item_var := FIND_ITEM(:SYSTEM.CURSOR_ITEM);

SET_ITEM_PROPERTY(item_var,position,30,55);

SET_ITEM_PROPERTY(item_var,prompt_text,’Current’);

END;

DECLARE

item_var item;

BEGIN

item_var := FIND_ITEM(:SYSTEM.CURSOR_ITEM);

SET_ITEM_PROPERTY(item_var,position,30,55);

SET_ITEM_PROPERTY(item_var,prompt_text,’Current’);

END;

2121--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Using Object IDsUsing Object IDs

• A PL/SQL variable has limited scope.• An .id extension:

– Broadens the scope– Converts to a numeric format– Enables assignment to a global variable– Converts back to the object data type

• A PL/SQL variable has limited scope.• An .id extension:

– Broadens the scope– Converts to a numeric format– Enables assignment to a global variable– Converts back to the object data type

2121--1717 Copyright Oracle Corporation, 2000. All rights reserved.

Referencing Objects IndirectlyReferencing Objects Indirectly

Direct referenceDirect reference

Indirect referenceIndirect reference

ITEM AITEM AKIDSPORT

ITEM BITEM BITEM A

ITEM AITEM AKidsport

2121--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Referencing Objects IndirectlyReferencing Objects Indirectly

The NAME_IN function:• Returns:

– The contents of variable– Character string

• Use conversion functions for NUMBER and DATE

The NAME_IN function:• Returns:

– The contents of variable– Character string

• Use conversion functions for NUMBER and DATE

2121--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Referencing Objects IndirectlyReferencing Objects Indirectly

The COPY procedure allows:• Direct copy

• Indirect copy

The COPY procedure allows:• Direct copy

• Indirect copy

COPY(’Kidsport’,’S_CUSTOMER.name’);COPY(’Kidsport’,’S_CUSTOMER.name’);

COPY(’Kidsport’,:GLOBAL.customer_name);COPY(’Kidsport’,:GLOBAL.customer_name);

2121--2020 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Use system variables:– To avoid hard-coding object names– To return information about the current state

of the form• Use GET_object_PROPERTY built-ins to return

current property values for Form Builder objects.

• Use system variables:– To avoid hard-coding object names– To return information about the current state

of the form• Use GET_object_PROPERTY built-ins to return

current property values for Form Builder objects.

2121--2121 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Use object IDs to improve performance.• Use indirect referencing to allow form module

variables to be referenced in library and menu modules.

• Use object IDs to improve performance.• Use indirect referencing to allow form module

variables to be referenced in library and menu modules.

2121--2222 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 21 OverviewPractice 21 Overview

This practices covers the following topics:• Populating product images only when the image

item is displayed• Modifying the When-Button-Pressed trigger of the

Image_Button in order to use object IDs instead of object names

This practices covers the following topics:• Populating product images only when the image

item is displayed• Modifying the When-Button-Pressed trigger of the

Image_Button in order to use object IDs instead of object names

Copyright Oracle Corporation, 2000. All rights reserved.

Sharing Objects and CodeSharing Objects and Code

2222--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following: • Describe the various methods for reusing objects

and code• Inherit properties from property classes• Group related objects for reuse• Reuse objects from an object library• Reuse PL/SQL code

After completing this lesson, you should be able to do the following: • Describe the various methods for reusing objects

and code• Inherit properties from property classes• Group related objects for reuse• Reuse objects from an object library• Reuse PL/SQL code

2222--33 Copyright Oracle Corporation, 2000. All rights reserved.

Sharing and Reusing CodeSharing and Reusing Code

• Increases productivity• Decreases maintenance• Increases modularity• Maintains standards

• Increases productivity• Decreases maintenance• Increases modularity• Maintains standards

2222--44 Copyright Oracle Corporation, 2000. All rights reserved.

Property ClassesProperty Classes

LOV

properties

Block

properties

Canvas

properties

Relation

properties

Item

properties

2222--55 Copyright Oracle Corporation, 2000. All rights reserved.

Property Class IconsProperty Class Icons

Add PropertyAdd Property Inherit PropertyInherit Property

Property ClassProperty ClassDelete PropertyDelete Property

2222--66 Copyright Oracle Corporation, 2000. All rights reserved.

Property palette

Default property

Inherited and Variant PropertiesInherited and Variant Properties

Default propertyDefault property

Property palette

Default propertyDefault property

Changed propertyChangeChangeDefault property

Property class

Apply

Property palette

Inherited property

Inherited property

Property palette

Inherited property

Inherited property

Variant propertyChangeChange

Inherited propertyInheritInherit

Inherited property

2222--77 Copyright Oracle Corporation, 2000. All rights reserved.

Inheriting PropertiesInheriting Properties

• Set the Subclass Information property.• Convert an inherited property to a variant

property.• Convert a variant property to an inherited

property.

• Set the Subclass Information property.• Convert an inherited property to a variant

property.• Convert a variant property to an inherited

property.

2222--88 Copyright Oracle Corporation, 2000. All rights reserved.

Object GroupObject Group

• Is a logical container• Enables you to:

– Group related objects– Copy multiple objects in one operation

• Is a logical container• Enables you to:

– Group related objects– Copy multiple objects in one operation

2222--99 Copyright Oracle Corporation, 2000. All rights reserved.

Using Object GroupsUsing Object Groups

• Blocks include:– Items– Item-level triggers– Block-level triggers– Relations

• Object groups cannot include other object groups• Deleting:

– An object group does not affect the objects– An object affects the object group

• Blocks include:– Items– Item-level triggers– Block-level triggers– Relations

• Object groups cannot include other object groups• Deleting:

– An object group does not affect the objects– An object affects the object group

2222--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Copying ObjectsCopying Objects

Ability to Ability to make exactmake exactcopy of objectcopy of object

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

2222--1111 Copyright Oracle Corporation, 2000. All rights reserved.

What Is Subclassing?What Is Subclassing?

Ability to Ability to make exactmake exactcopy of objectcopy of object

Ability to add Ability to add to objectto object

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Address:

Code:

Company Name:

Company Code:

Balance:

2222--1212 Copyright Oracle Corporation, 2000. All rights reserved.

SubclassingSubclassing

Ability to Ability to make exactmake exactcopy of objectcopy of object

Ability to add Ability to add to objectto object

AbilityAbilityto alterto alterpropertiesproperties

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Address:

Code:

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

2222--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Inheriting ChangesInheriting Changes

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Address:

Code:

Make changes to parentMake changes to parent

AbilityAbilityto inheritto inheritchangeschanges

AbilityAbilityto inheritto inheritchangeschanges

AbilityAbilityto inheritto inheritchangeschanges

2222--1414 Copyright Oracle Corporation, 2000. All rights reserved.

An Object LibraryAn Object Library

• Is a convenient container of objects for reuse• Simplifies reuse in complex environments• Supports corporate, project, and personal

standards• Simplifies the sharing of reusable components

• Is a convenient container of objects for reuse• Simplifies reuse in complex environments• Supports corporate, project, and personal

standards• Simplifies the sharing of reusable components

2222--1515 Copyright Oracle Corporation, 2000. All rights reserved.

Object LibrariesObject Libraries

• Appear in the Navigator if they are open• Are used with a simple tabbed interface• Are saved to .olb file or to

database

• Appear in the Navigator if they are open• Are used with a simple tabbed interface• Are saved to .olb file or to

database

2222--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Benefits of the Object LibraryBenefits of the Object Library

• Simplifies the sharing and reuse of objects• Provides control and enforcement of standards• Eliminates the need to maintain multiple

referenced forms

• Simplifies the sharing and reuse of objects• Provides control and enforcement of standards• Eliminates the need to maintain multiple

referenced forms

2222--1717 Copyright Oracle Corporation, 2000. All rights reserved.

A SmartClassA SmartClass

• Is an object in an object library that is frequently used as a class

• Can be applied easily and rapidly to existing objects

• Can be defined in many object libraries

You can have many SmartClasses of a given object type.

• Is an object in an object library that is frequently used as a class

• Can be applied easily and rapidly to existing objects

• Can be defined in many object libraries

You can have many SmartClasses of a given object type.

Check indicates a SmartClass.Check indicates a SmartClass.Check indicates a SmartClass.

2222--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Working with SmartClassesWorking with SmartClasses

1. Select an object in theLayout Editor or Navigator.

2. From the pop-up menu,select SmartClasses.

3. Select a class from the list.

1. Select an object in theLayout Editor or Navigator.

2. From the pop-up menu,select SmartClasses.

3. Select a class from the list.

2222--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Reusing PL/SQLReusing PL/SQL

• Triggers:– Copy and paste text– Copy and paste within a module– Copy to or subclass from another module– Move to an object library

• PL/SQL program units:– Copy and paste text– Copy and paste within a module– Copy to or subclass in another module– Create a library module– Move to an object library

• Triggers:– Copy and paste text– Copy and paste within a module– Copy to or subclass from another module– Move to an object library

• PL/SQL program units:– Copy and paste text– Copy and paste within a module– Copy to or subclass in another module– Create a library module– Move to an object library

2222--2020 Copyright Oracle Corporation, 2000. All rights reserved.

PL/SQL LibrariesPL/SQL Libraries

ApplicationsApplications

Form modulesForm modulesMenu modulesMenu modules

Report modulesReport modulesGraphic modulesGraphic modules

.pll.pll ororDatabaseDatabase

Procedures

Functions

Packages

LibraryLibrary

2222--2121 Copyright Oracle Corporation, 2000. All rights reserved.

Writing Code for LibrariesWriting Code for Libraries

• A library is a separate module, holding procedures, functions, and packages.

• Direct references to bind variables are not allowed.• Use subprogram parameters for passing bind

variables.• Use functions, where appropriate,

to return values.

• A library is a separate module, holding procedures, functions, and packages.

• Direct references to bind variables are not allowed.• Use subprogram parameters for passing bind

variables.• Use functions, where appropriate,

to return values.

2222--2222 Copyright Oracle Corporation, 2000. All rights reserved.

Creating Library Program UnitsCreating Library Program Units

2222--2323 Copyright Oracle Corporation, 2000. All rights reserved.

Attach Library Dialog BoxAttach Library Dialog Box

2222--2424 Copyright Oracle Corporation, 2000. All rights reserved.

Calls and SearchesCalls and Searches

procedure ( );

...function...

package.call ( );

procedure ( );

...function...

package.call ( );•Program Units

PROCA

PROCB

•Attached Libraries•Database

CallsCalls

SearchesSearches

2222--2525 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Reasons to share objects and code:– Increased productivity– Increased modularity– Decreased maintenance– Maintaining standards

• Reasons to share objects and code:– Increased productivity– Increased modularity– Decreased maintenance– Maintaining standards

2222--2626 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Methods of sharing objects and code:– Using property classes– Using object groups– Copying– Subclassing– Creating a library module– Using object libraries

• Methods of sharing objects and code:– Using property classes– Using object groups– Copying– Subclassing– Creating a library module– Using object libraries

2222--2727 Copyright Oracle Corporation, 2000. All rights reserved.

Practice 22 OverviewPractice 22 Overview

This practice covers the following topics:• Creating an object group and using this object

group in a new form module• Using property classes• Creating an object library and using this object

library in a new form module• Setting and using SmartClasses

This practice covers the following topics:• Creating an object group and using this object

group in a new form module• Using property classes• Creating an object library and using this object

library in a new form module• Setting and using SmartClasses

Copyright Oracle Corporation, 2000. All rights reserved.

Introducing Multiple Form ApplicationsIntroducing Multiple Form Applications

Copyright Oracle Corporation, 2000. All rights reserved.2323--22

ObjectivesObjectives

After completing this lesson, you should be able to do the following: • Call one form from another form module• Define multiple form functionality

After completing this lesson, you should be able to do the following: • Call one form from another form module• Define multiple form functionality

Copyright Oracle Corporation, 2000. All rights reserved.2323--33

Multiple Form ApplicationsMultiple Form Applications

• Behavior:– Flexible navigation between windows– Single or multiple database connections– Transactions may span forms, if required– Commits in order of opening forms, starting

with current form• Links:

– Data is exchanged by global variables or parameter lists

– Code is shared as required, through libraries and the database

• Behavior:– Flexible navigation between windows– Single or multiple database connections– Transactions may span forms, if required– Commits in order of opening forms, starting

with current form• Links:

– Data is exchanged by global variables or parameter lists

– Code is shared as required, through libraries and the database

Copyright Oracle Corporation, 2000. All rights reserved.2323--44

Multiple Form SessionMultiple Form Session

Form A

Forms Forms RuntimeRuntime

Global variablesGlobal variables

Form BOpenOpen

Form C

OpenOpen

Form D

OpenOpen

Copyright Oracle Corporation, 2000. All rights reserved.2323--55

OPEN_FORMOPEN_FORM

MDI

FORM A

MDI

FORM A

Modeless

FORM BOPEN_FORM

Copyright Oracle Corporation, 2000. All rights reserved.2323--66

OPEN_FORM and the Summit ApplicationOPEN_FORM and the Summit Application

• Scenario:Run the CUSTOMERS and ORDERS forms in the same session, navigating freely between them. You can make changes in the same transaction across forms. All forms are visible together.

• Scenario:Run the CUSTOMERS and ORDERS forms in the same session, navigating freely between them. You can make changes in the same transaction across forms. All forms are visible together.

Copyright Oracle Corporation, 2000. All rights reserved.2323--77

OPEN_FORM and the Summit ApplicationOPEN_FORM and the Summit Application

• Actions:1. Define windows and positions for each form.2. Plan global variables and their names.3. Implement triggers to:– Open other forms– Initialize globals from calling forms– Use globals in opened forms

• Actions:1. Define windows and positions for each form.2. Plan global variables and their names.3. Implement triggers to:– Open other forms– Initialize globals from calling forms– Use globals in opened forms

Copyright Oracle Corporation, 2000. All rights reserved.2323--88

Linking by Global VariablesLinking by Global Variables

ORDERS

Customer_IDOrder

CUSTOMERS

Customer

ID

GLOBAL.CUSTOMERID

Copyright Oracle Corporation, 2000. All rights reserved.2323--99

Opening Another FormOpening Another Form

Example:

Notes• Control passes immediately to the ORDERS

form—no statements after OPEN_FORM are processed.

• If the Activate_Mode argument is set to NO_ACTIVATE, you retain control in the current form.

• The transaction continues unless it was explicitly committed before.

Example:

Notes• Control passes immediately to the ORDERS

form—no statements after OPEN_FORM are processed.

• If the Activate_Mode argument is set to NO_ACTIVATE, you retain control in the current form.

• The transaction continues unless it was explicitly committed before.

:GLOBAL.customerid := :S_CUSTOMER.id;

OPEN_FORM(’ORDERS’);

:GLOBAL.customerid := :S_CUSTOMER.id;

OPEN_FORM(’ORDERS’);

Copyright Oracle Corporation, 2000. All rights reserved.2323--1010

Restricted Query at StartupRestricted Query at Startup

Execute_Query;Execute_Query;

:S_ORD.customer_id := :GLOBAL.customerid;:S_ORD.customer_id := :GLOBAL.customerid;

WhenWhen--NewNew--FormForm--InstanceInstance

PrePre--QueryQuery

Copyright Oracle Corporation, 2000. All rights reserved.2323--1111

Assigning Global Variables in the Opened Form

Assigning Global Variables in the Opened Form

• DEFAULT_VALUE ensures the existence of globals.

• You can use globals to communicate that the form is running.

• DEFAULT_VALUE ensures the existence of globals.

• You can use globals to communicate that the form is running.

DEFAULT_VALUE(’’, ’GLOBAL.customerid’);DEFAULT_VALUE(’’, ’GLOBAL.customerid’);

Pre-Form example:Pre-Form example:

Copyright Oracle Corporation, 2000. All rights reserved.2323--1212

Conditional OpeningConditional Opening

Example:Example:

:GLOBAL.customerid := :S_CUSTOMER.id;

IF ID_NULL(FIND_FORM(’ORDERS’)) THEN

OPEN_FORM(’ORDERS’);

ELSE

GO_FORM(’ORDERS’);

END IF;

:GLOBAL.customerid := :S_CUSTOMER.id;

IF ID_NULL(FIND_FORM(’ORDERS’)) THEN

OPEN_FORM(’ORDERS’);

ELSE

GO_FORM(’ORDERS’);

END IF;

Copyright Oracle Corporation, 2000. All rights reserved.2323--1313

Closing the SessionClosing the Session

“Will the last one out please turn off the lights”“Will the last one out please turn off the lights”

RuntimeForm A

Form B

Form C

Copyright Oracle Corporation, 2000. All rights reserved.2323--1414

Closing a Form with EXIT_FORM

Closing a Form with EXIT_FORM

• The default functionality is the same as for the Exit key.

• The Commit_Mode argument defines action on uncommitted changes.

• The default functionality is the same as for the Exit key.

• The Commit_Mode argument defines action on uncommitted changes.

ENTER;

IF :SYSTEM.FORM_STATUS = ’CHANGED’ THEN

EXIT_FORM( DO_COMMIT );

ELSE

EXIT_FORM( NO_COMMIT );

END IF;

ENTER;

IF :SYSTEM.FORM_STATUS = ’CHANGED’ THEN

EXIT_FORM( DO_COMMIT );

ELSE

EXIT_FORM( NO_COMMIT );

END IF;

Copyright Oracle Corporation, 2000. All rights reserved.2323--1515

Other Useful TriggersOther Useful Triggers

Maintain referential links between forms throughglobal variables:• In the parent form:

– When-Validate-Item– When-New-Record-Instance

• In opened forms: When-Create-Record

Maintain referential links between forms throughglobal variables:• In the parent form:

– When-Validate-Item– When-New-Record-Instance

• In opened forms: When-Create-Record

Copyright Oracle Corporation, 2000. All rights reserved.2323--1616

SummarySummary

• The OPEN_FORM built-in provides multiple concurrent forms in a session.

• Forms communicate through global variables:– Load key values in the parent form– Use global values in opened forms for

When-New-Form-Instance and Pre-Query

• The OPEN_FORM built-in provides multiple concurrent forms in a session.

• Forms communicate through global variables:– Load key values in the parent form– Use global values in opened forms for

When-New-Form-Instance and Pre-Query

Copyright Oracle Corporation, 2000. All rights reserved.2323--1717

Practice 23 OverviewPractice 23 Overview

This practice covers the following topics:• Linking ORDERS and CUSTOMERS forms by using

a global variable• Using built-ins to check whether the ORDERS form

is running• Using global variables to restrict a query in the

ORDERS form

This practice covers the following topics:• Linking ORDERS and CUSTOMERS forms by using

a global variable• Using built-ins to check whether the ORDERS form

is running• Using global variables to restrict a query in the

ORDERS form

Copyright Oracle Corporation, 2000. All rights reserved.

Locking in Form BuilderLocking in Form Builder

DD--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Identify the locking mechanisms in Form Builder• Write triggers to invoke or intercept the locking

process• Plan trigger code to minimize overheads

on locking

After completing this lesson, you should be able to do the following:• Identify the locking mechanisms in Form Builder• Write triggers to invoke or intercept the locking

process• Plan trigger code to minimize overheads

on locking

DD--33 Copyright Oracle Corporation, 2000. All rights reserved.

LockingLocking

Table in (RX)

Row in (X)

Row in (X)

Insert, update, or delete

Insert, update, or delete

Query

DD--44 Copyright Oracle Corporation, 2000. All rights reserved.

Default Locking in Form BuilderDefault Locking in Form Builder

Insert record

Update record

Delete record

SaveAction

No locks

RS on table

RS on table

RX on above

DD--55 Copyright Oracle Corporation, 2000. All rights reserved.

Concurrent Updates and DeletesConcurrent Updates and Deletes

• When users compete for the same record, normal locking protection applies.

• Form Builder tells the operator if another user has already locked the record.

• When users compete for the same record, normal locking protection applies.

• Form Builder tells the operator if another user has already locked the record.

DD--66 Copyright Oracle Corporation, 2000. All rights reserved.

User A: Step 1User A: Step 1

DD--77 Copyright Oracle Corporation, 2000. All rights reserved.

User B: Step 2User B: Step 2

DD--88 Copyright Oracle Corporation, 2000. All rights reserved.

User A: Step 3User A: Step 3

DD--99 Copyright Oracle Corporation, 2000. All rights reserved.

User B: Step 4User B: Step 4

DD--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Concurrent Updates and DeletesConcurrent Updates and Deletes

Achieved by:• SQL data manipulation language• SQL explicit locking statements• Built-in subprograms• DML statements

Achieved by:• SQL data manipulation language• SQL explicit locking statements• Built-in subprograms• DML statements

DD--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Locking with Built-insLocking with Built-ins

• ENTER_QUERY (FOR_UPDATE)• EXECUTE_QUERY (FOR_UPDATE)• ENTER_QUERY (FOR_UPDATE)• EXECUTE_QUERY (FOR_UPDATE)

DD--1212 Copyright Oracle Corporation, 2000. All rights reserved.

On-Lock TriggerOn-Lock Trigger

ExampleIF USER = 'MANAGER' THEN

LOCK_RECORD;

ELSE

MESSAGE('You are not authorized to change recordshere');

RAISE form_trigger_failure;

END IF;

ExampleIF USER = 'MANAGER' THEN

LOCK_RECORD;

ELSE

MESSAGE('You are not authorized to change recordshere');

RAISE form_trigger_failure;

END IF;

DD--1313 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Default locking – Locks rows during update and delete– Informs user of concurrent update and delete

• Locking in triggers – Use SQL and certain built-ins– On-Lock trigger: LOCK_RECORD built-in

available

• Default locking – Locks rows during update and delete– Informs user of concurrent update and delete

• Locking in triggers – Use SQL and certain built-ins– On-Lock trigger: LOCK_RECORD built-in

available

Copyright Oracle Corporation, 2000. All rights reserved.

Oracle8 Object FeaturesOracle8 Object Features

EE--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Describe the Oracle8 scalar datatypes• Describe object types and objects• Describe object tables, object columns, and object

views• Describe the INSTEAD-OF triggers• Describe object REFs• Identify the display of objects in the Object

Navigator

After completing this lesson, you should be able to do the following:• Describe the Oracle8 scalar datatypes• Describe object types and objects• Describe object tables, object columns, and object

views• Describe the INSTEAD-OF triggers• Describe object REFs• Identify the display of objects in the Object

Navigator

EE--33 Copyright Oracle Corporation, 2000. All rights reserved.

Oracle8 Scalar DatatypesOracle8 Scalar Datatypes

• NCHAR• NVARCHAR2• FLOAT• NLS types

• NCHAR• NVARCHAR2• FLOAT• NLS types

EE--44 Copyright Oracle Corporation, 2000. All rights reserved.

Object TypesObject Types

AttributesAttributes

po_nocustinfo

line_itemsamount

MethodsMethods

ShipShip

CancelCancel

HoldHold

Check Check statusstatus

ORDER

EE--55 Copyright Oracle Corporation, 2000. All rights reserved.

Object TablesObject Tables

Object table based on object typeObject table based on object type

EE--66 Copyright Oracle Corporation, 2000. All rights reserved.

Object ColumnsObject Columns

Object column based on object typeObject column based on object type

EE--77 Copyright Oracle Corporation, 2000. All rights reserved.

Object ViewsObject Views

Object views based on object typesObject views based on object types

ObjectObjectviewviewObjectObject--oriented oriented

applicationapplicationRelationalRelational

tabletable

EE--88 Copyright Oracle Corporation, 2000. All rights reserved.

INSTEAD-OF TriggersINSTEAD-OF Triggers

INSTEADINSTEAD--OF OF TriggerTrigger

Nonupdatable Nonupdatable viewview

DECLAREDECLARE

BEGINBEGIN

EXCEPTIONEXCEPTION

END;END;

EE--99 Copyright Oracle Corporation, 2000. All rights reserved.

References to ObjectsReferences to Objects

OIDOID

EE--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Object Types in Object NavigatorObject Types in Object Navigator

EE--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Object Type Wizard Object Type Wizard

EE--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Object Tables in Object NavigatorObject Tables in Object Navigator

EE--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Object Columns in Object NavigatorObject Columns in Object Navigator

EE--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Object Views in Object NavigatorObject Views in Object Navigator

EE--1515 Copyright Oracle Corporation, 2000. All rights reserved.

INSTEAD-OF Trigger Dialog BoxINSTEAD-OF Trigger Dialog Box

EE--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Object REFs in Object NavigatorObject REFs in Object Navigator

EE--1717 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• Oracle8 introduced three scalar datatypes.• Objects and object types allow representation of

complex data.• Three kinds of objects are object tables, object

columns, and object views.

• Oracle8 introduced three scalar datatypes.• Objects and object types allow representation of

complex data.• Three kinds of objects are object tables, object

columns, and object views.

EE--1818 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• INSTEAD-OF triggers allow DML on object views.• Object REFs store the object identifier of certain

types of objects.• The Object Navigator can display certain types of

objects.

• INSTEAD-OF triggers allow DML on object views.• Object REFs store the object identifier of certain

types of objects.• The Object Navigator can display certain types of

objects.

Copyright Oracle Corporation, 2000. All rights reserved.

Using the Layout EditorUsing the Layout Editor

FF--22 Copyright Oracle Corporation, 2000. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:• Control the position and size of objects in a layout• Add lines and geometric shapes• Define the colors and fonts used for text• Color the body and boundaries of objects• Import images onto the layout

After completing this lesson, you should be able to do the following:• Control the position and size of objects in a layout• Add lines and geometric shapes• Define the colors and fonts used for text• Color the body and boundaries of objects• Import images onto the layout

FF--33 Copyright Oracle Corporation, 2000. All rights reserved.

Using the Layout EditorUsing the Layout Editor

Common features:• Moving and resizing objects and text• Defining colors and fonts• Importing and manipulating images and drawings• Creating geometric lines and shapes

Common features:• Moving and resizing objects and text• Defining colors and fonts• Importing and manipulating images and drawings• Creating geometric lines and shapes

FF--44 Copyright Oracle Corporation, 2000. All rights reserved.

Using the Layout EditorUsing the Layout Editor

Layout types:• Canvases in Forms• Report layouts

Layout types:• Canvases in Forms• Report layouts

FF--55 Copyright Oracle Corporation, 2000. All rights reserved.

Invoking the Layout EditorInvoking the Layout EditorInvoking the Layout Editor

FF--66 Copyright Oracle Corporation, 2000. All rights reserved.

Layout Editor: ComponentsLayout Editor: ComponentsLayout Editor: Components1

6

5

3

2

4

FF--77 Copyright Oracle Corporation, 2000. All rights reserved.

Tool PaletteTool PaletteTool Palette

1234567

89

10111213

FF--88 Copyright Oracle Corporation, 2000. All rights reserved.

Selecting ObjectsSelecting ObjectsSelecting Objects

FF--99 Copyright Oracle Corporation, 2000. All rights reserved.

Manipulating ObjectsManipulating ObjectsManipulating Objects

Expand/contractExpand/contractin one directionin one direction

Expand/contractExpand/contractdiagonallydiagonally

FF--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Moving, Aligning, and OverlappingMoving, Aligning, and OverlappingMoving, Aligning, and Overlapping

FF--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Groups in the LayoutGroups in the Layout

• Groups allow several objects to be repeatedly treated as one.

• Groups can be colored, moved, or resized.• Tool-specific operations exist for groups.• Groups have a single set of selection handles.• Members can be added or removed.

• Groups allow several objects to be repeatedly treated as one.

• Groups can be colored, moved, or resized.• Tool-specific operations exist for groups.• Groups have a single set of selection handles.• Members can be added or removed.

FF--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Format MenuFormat MenuFormat Menu

FF--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Color and Pattern ToolsColor and Pattern ToolsColor and Pattern Tools

23

4

1

FF--1414 Copyright Oracle Corporation, 2000. All rights reserved.

Importing ImagesImporting ImagesImporting Images

FF--1515 Copyright Oracle Corporation, 2000. All rights reserved.

SummarySummary

• You can create objects by:– Choosing a palette tool– Clicking and dragging on a layout region

• There are color palette tools for fill area, lines, and text.

• View, Arrange, and Format menus are available for layout.

• Objects can be grouped for operations.• You can import images and drawings by using

File—>Import.

• You can create objects by:– Choosing a palette tool– Clicking and dragging on a layout region

• There are color palette tools for fill area, lines, and text.

• View, Arrange, and Format menus are available for layout.

• Objects can be grouped for operations.• You can import images and drawings by using

File—>Import.

Copyright Oracle Corporation, 2000. All rights reserved.

Introduction to Query BuilderIntroduction to Query Builder

GG--22 Copyright Oracle Corporation, 2000. All rights reserved.

Query Builder FeaturesQuery Builder Features

• Easy-to-use data access tool• Point-and-click graphical user interface• Distributed data access• Powerful query building

• Easy-to-use data access tool• Point-and-click graphical user interface• Distributed data access• Powerful query building

GG--33 Copyright Oracle Corporation, 2000. All rights reserved.

Query Builder WindowQuery Builder Window

1

2 3

GG--44 Copyright Oracle Corporation, 2000. All rights reserved.

Building a New QueryBuilding a New Query

GG--55 Copyright Oracle Corporation, 2000. All rights reserved.

Datasource ComponentsDatasource Components

2

3

4

1 5

6

7

8

GG--66 Copyright Oracle Corporation, 2000. All rights reserved.

Refining a QueryRefining a Query

GG--77 Copyright Oracle Corporation, 2000. All rights reserved.

Sorting DataSorting Data

GG--88 Copyright Oracle Corporation, 2000. All rights reserved.

Viewing and Saving QueriesViewing and Saving Queries

GG--99 Copyright Oracle Corporation, 2000. All rights reserved.

Including Additional TablesIncluding Additional Tables

GG--1010 Copyright Oracle Corporation, 2000. All rights reserved.

Viewing CommentsViewing Comments

GG--1111 Copyright Oracle Corporation, 2000. All rights reserved.

Including Related TablesIncluding Related Tables

GG--1212 Copyright Oracle Corporation, 2000. All rights reserved.

Creating a User-Defined RelationshipCreating a User-Defined Relationship

GG--1313 Copyright Oracle Corporation, 2000. All rights reserved.

Unmatched RowsUnmatched Rows

GG--1414 Copyright Oracle Corporation, 2000. All rights reserved.

ConditionsConditions

GG--1515 Copyright Oracle Corporation, 2000. All rights reserved.

OperatorsOperators

Arithmetic• Perform calculations on numeric and date columns• Examples: +, -, x, /

Logical• Combine conditions• Examples: AND, OR, NOT

Comparison• Compare one expression with another• Examples: =, <>, <, IN, IS NULL,

BETWEEN ... AND

Arithmetic• Perform calculations on numeric and date columns• Examples: +, -, x, /

Logical• Combine conditions• Examples: AND, OR, NOT

Comparison• Compare one expression with another• Examples: =, <>, <, IN, IS NULL,

BETWEEN ... AND

GG--1616 Copyright Oracle Corporation, 2000. All rights reserved.

Multiple ConditionsMultiple Conditions

GG--1717 Copyright Oracle Corporation, 2000. All rights reserved.

Deactivating a ConditionDeactivating a Condition

GG--1818 Copyright Oracle Corporation, 2000. All rights reserved.

Defining Columns Using an ExpressionDefining Columns Using an Expression

GG--1919 Copyright Oracle Corporation, 2000. All rights reserved.

Defining Columns Using a FunctionDefining Columns Using a Function