Chapter 5

advertisement

Oracle Forms 6i Tutorial

Naresh HS

Client Logo

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 1

Chapter 1: Developer 2000 Components

Project Builder

Form Builder

Report Builder

 Graphics Builder

 Query Builder

 Schema Builder

 Procedure Builder

 Translation Builder

Chapter 1

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 2

Oracle Forms Builder Chapter 1

Four components make up the interface to Oracle Forms Builder, they are

Object Navigator : is primarily used to move quickly between the other three interfaces.

Property palette : is where we set object attributes.

 Layout Editor : This is the place where all objects for the particular screen that are shown are placed.

 PL/SQL Editor : is where all PL/SQL code can be added, modified, removed and compiled.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 3

Oracle Forms Compiler and Runtime Chapter 1

• Forms Compiler

It is used to create executable files for runtime deployment. While compiling a form module all of its object code is compiled ( stored as .fmb ) and .fmx

is created. These .fmx

are finally executed.

• Forms Runtime

The runtime is the engine that form operators use to run a finished Oracle

Forms application.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 4

Components of Oracle Forms

Application Chapter 1

 We need to create various Objects and set properties for building the Forms

Applications.

These objects are Items, Records, Blocks, Canvases, Frames, Windows.

Items : are interface objects that display information to users and allow them to interact with our application.

 Records : are groups of items from a table.

 Block : is an object that represents a logical container for grouping related items into a function unit for storing, displaying and manipulating records.

 If the block contains items, that are not from the database table, then the block is known as a CONTROL BLOCK.

Otherwise its called DATA BLOCK .

 Frames : Frames are graphical objects appearing on a canvas.

 Canvas : All items need to be assigned to a CANVAS for its display.

 Window : A canvas is displayed in a window.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 5

Chapter 2: Property Palette

 Property palette is where you set the properties of objects you create in form and menu modules.

Invoking Property Palette : The ways in which you can invoke the Property Palette are

Select Tools | Property Palette

 Double – click the objects icon for any object except code objects and canvas – views.

 Double click an item in the Layout Editor.

 Features of the Property Palette

 Name field displays the name of the object currently selected.

Text field is displayed when the current property can be set by entering a text value.

Poplist is displayed for properties that are either yes/no, or that have a fixed set of valid values.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 6

Layout Editor Chapter 2

 Layout Editor is a graphical design facility for creating and arranging interface items, boilerplate texts and graphics in a form.

In Layout Editor you can work on a single canvas-view which are displayed in windows at runtime.

 To invoke the Layout Editor

 In navigator, double click the object icon for the canvas-view you want to edit

 In navigator, choose Layout Editor in from the Popup menu.

 Choose Tools | Layout Editor and indicate the canvas

– view you want to work

 Features of Layout Editor

If there is only one canvas-view in the form, Oracle Forms displays it in the Layout Editor automatically. A default canvas-view is created automatically by the Oracle Forms.

 If there are more than one canvas-views, then list of values of the canvas-view is listed for selection from which you can select the canvas-view you want to edit.

 Rulers: The Horizontal and Vertical rulers at the top and left side of the workspace provide a reference for sizing and arranging objects in the Layout Editor.

 Grids : There is a grid defined within the workspace that helps us position objects.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 7

Layout Editor …cont…2 Chapter 2

 Use Layout Editor Tools Palette to create and manipulate items and

Boilerplate objects.

 Layout Editor Tool Palette consists of the following Tools:

 Layout Tools

 Boilerplate Drawing Tools

 Item Drawing Tolls

 Fill/Line Color Palettes

 Boilerplate graphics are the lines, circles, test and images that we draw or import onto a canvas-view.

 To make the Block as a multi-record block, change the property Number of

Records displayed of the block more than 1 then the form displays multiple records.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 8

Chapter 3: Items and Blocks Chapter 3

 Blocks

There are two types of blocks. Control Block and Base Table block.

 As defined earlier Control blocks don’t have the table associated to it and where as the later has an association with some table or view.

 Creating Blocks

 To create blocks you can do manually or you can use the wizard for creating it.

 While creating each column specify and set Name, Data Type and Max Length.

 Items

 Forms support different types of interface items, which can be utilized in building applications interface they are

ActiveX, Bean Area, Chart Item, Check Box, Display Item, Hierarchical tree item,

Image Item, List Item, Push Button, Radio Group, Text Item, Sound Item, User area.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 9

Chapter 4: Defining Items

 Buttons : Buttons are interface items that operators select to execute commands or initiate actions. Oracle Forms support 2 styles

Text Button : displayed as a rectangle with a text label that describes its action.

Iconic Button : displayed as graphic icons, without text labels.

 Creating Buttons in Object Navigator

 In the Object navigator, select the block where you want to insert the button 

Select Items Node  Choose Navigator | Create

 In the Property Palette, set the Item Type Property to Button and enter the desired text in the Label Property field.

Creating Buttons in Layout Editor

Click the Button Tool

Place the Mouse pointer at the required place and then click and drag the button to size  Go to Property Palette and set the properties accordingly.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 10

Defining Check Box Chapter 4

 Check Box : is a two-state control that indicates whether a certain condition or value is on or off i.e. True or False . The value of the check box can be set by fetching records from a corresponding database column, by operator input or through default value or runtime assignment. Check box values can be of Char, Number and Date data type.

 Creating Check Box

 In the Object navigator, select the block where you want to insert the Check Box, then select Items node  Choose Navigator | Create

 In the Property Palette, set the Item Type Property to Check Box and enter the desired text in the Label Property field. The label is displayed to the right of the

Check Box element at runtime.

 Specify the values you want the Check Box to display as “Checked” and

“Unchecked” in Value when checked and Value when unchecked Property field.

 Set the Check Box, Mapping of Other Values to specify how you want the Check

Box to handle other values.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 11

Defining Display Item and List items Chapter 4

 Display Item :are similar to text items with the exception that Display Items only store and display fetched or assigned values. Operators cannot navigate to display item values. Values are assigned to a display items through PL/SQL code only, also fetched from the PL/SQL code only.

 Creating Display Items : To create a display item, you either insert a new display item into a block or you modify an existing item by converting its type to Display item.

 In the Object navigator, select the block where you want to insert the Display Items, then select

Items node  Choose Navigator | Create.

 In the Property Palette, set the Item Type Property to Display Items.

 List Item : is a list of text elements that can be displayed a either a Poplist, Tlist, or Combo Box. A list item displays a fixed number of elements. Each element in a list is a text string up to 30 characters.

 Creating List Item

 In the Object navigator, select the block where you want to insert the List Item, then select Items node  Choose Navigator | Create. In the Property Palette, set the Item Type Property to list item.

 Specify the display style for the List Style Property to POPLIST , TLIST or COMBO BOX .

Double click on the LIST element dialog, then enter the elements exactly as you want them to appear in the list at runtime. Associate a value with each element in the list and then choose

OK.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 12

Defining Radio Groups Chapter 4

 Radio Group :is an interface control that displays a fixed number of options that are mutually exclusive each option is represented by as individual Radio Button. A value is associated with each radio button in the group.

 Creating Radio Buttons :

 In the Object navigator, select the block where you want to insert the radio group, then select Items node  Choose Navigator | Create.

 In the Property Palette, set the Item Type Property to Radio Group.

 We can create the desired number of radio buttons by expanding the radio item, then selecting the Radio Buttons node and then choosing Navigator | Create.

In the property palette, create a label for the radio button by entering the desired text in the label property field. Enter a value for this radio button in the Value Property field.

 In the Layout Editor, position the Radio Buttons at the appropriate places.

 The values assigned to the Radio Button must be compatible with the datatype of the Radio

Group.

 Mapping of Other Values property specify how to handle a fetched or assigned value that is not one of the values associated with specific Radio Button. Blank in this field indicate that other values not allowed.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 13

Defining Text Items Chapter 4

 Text Items :is an interface control that allows operator to enter text in a field.

 Creating Text Items :In the Object navigator, select the block where you want to insert the

Text Item, then select Items node

Choose Navigator | Create. In the Property Palette, set the Item Type Property to Text Item .

 Forms Supports both single-line and Multi-line text itmes.

 Multi-line Text Items Property : Setting this property to Yes allows a text item to store multiple line of the text, but it does not automatically make the item large enough to display multiple-lines. Wrap Style Property of Multi-line text items : this property determines how text is displayed when a line of text exceeds the width of a text item or editor window.

 Scroll bar Property : The number of characters that can fit on one line is determined by the width of the text item and the font assigned to it. Scroll bars allow the operator to scroll upward and downward when viewing text item.

 Required Valid Data Values Property: The properties that can be set to specify the values valid for a text item are Maximum Length, Required, Fixed Length, Range Low Value/

Range High Value.

 Format mask allows automatically embed special characters such as dashes and monetary symbols, in values entered by operators.

CSC Proprietary 4/11/2020 1:53:41 AM 008_fmt_wht 14

Chapter 5: Triggers

 Triggers :are blocks of PL/SQL code that are written to perform tasks when a specific event occurs within an application. Form builder trigger is an event-handler written in PL/SQL to augment (or occasionally replace) the default processing behavior. When Form builder responds to an event by executing the code in a trigger, that trigger is said to have “Fired”.

 Events and Triggers :

 An event occurs when the user performs an action with the mouse/ keyboard or some internal processing takes place.

 When an event occurs windows environment sends message to various objects in the application.

 Oracle Forms responds to an event by executing a trigger when such a trigger is associated with the object for the specific event.

 A trigger is attached to an item or to a block or to a form itself, and based on the object to which it is attached defines the scope of the trigger.

 Types of Triggers : Interface events like When-button-pressed,When-CheckBox-Changed,

When-window-Activated etc, and Internal Processing events like When-validate-Item, Post-

Block, Pre-Block etc.

 Interface Events triggers fire in response to events that occur in the form interface.

 Internal Events occur as a result of runtime processing.

 Some triggers can be defined only at particular definition level. Ex : When-validate-Record, which fires when the Validate the Record even occurs and is valid only attached to a block or to the form.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 15

Creating Triggers Chapter 5

 Creating Trigger in Object Navigator

 In the Object navigator, position the cursor on the Triggers node under the form, block or item to which trigger needs to be attached. Choose Navigator | Create, to invoke the

Triggers LOV. Select the trigger name from the LOV.

 The PL/SQL editor appears. The Type, Object and Name options are set for automatically, based on the object to which trigger is attached and the trigger name selected from the

LOV.In the PL/SQL editor, enter the desired trigger code. Choose Compile to compile the trigger and then choose close to dismiss the editor.

In the Property Palette, set the Item Type Property to Text Item . While creating each column specify and set Name, Data Type and Max Length.

 Creating Trigger in PL/SQL editor

 In the PL/SQL editor, set the Type option to Trigger.

 Set the Object options to specify the object( Form, Block or Item) for which you are defining the trigger. Choose New to invoke the Triggers LOV. Select the desired trigger name from the LOV.

Enter the desired trigger code. Choose Compile to compile and close to dismiss the editor.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 16

Creating Triggers.. continued… Chapter 5

 Creating Trigger in Layout editor

 In the Layout editor, select the item to which you want to attach the trigger.

From the Pop-up menu select the trigger to invoke the PL/SQL editor to create the trigger.

 Write appropriate code and Choose OK and the PL/SQL editor appears with the settings based on the object you have selected, enter the code, and choose compile the trigger code. Choose close to return to the Object Navigator.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 17

Creating Triggers.. continued… Chapter 5

 Creating Trigger in SmartTriggers

 Clicking the object in the Object Navigator with the right mouse button displays a pop-up menu that includes the item SmartTriggers. The item expands a lost of common triggers that make sense for the selected object.

 On clicking any of the triggers, Form builder automatically creates the trigger and opens the PL/SQL editor.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 18

Calling sub programs in Triggers Chapter 5

 Need of the Sub programs to be called in Triggers

 The built-in subprograms are used to control the run-time behavior of an application.

Programmatically move the input focus from one item to another.

 To perform the operations on the data in the Form or in the database.

 To control the display of interface objects at runtime, etc.

 Restrictions in Built-in sub-programs

 Any built-in sub-program that initiates navigation is restricted. Ex : Go_Item,

Next_Set

Referencing of items is done by putting a colon (:) in front of the fully qualified item name.

 Also items can referenced indirectly with the Name_in and Copy built-in subprograms.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 19

Overview of Trigger categories Chapter 5

 Block processing triggers

 These triggers fire in response to events related to record management in a block. Ex are

When-Create-Record, When-Clear-Block, When-Database-Record, When-Remove-

Record etc.

 Interface event triggers

 These triggers fire in response to events that occur in the Form interface. Ex are When-

Button-Pressed, When-CheckBox-Changed, When-Image-Activated, When-Radio-

Changed etc.

Master-Detail triggers

Oracle Forms generates Master/Detail triggers automatically when you define a

Master/Detail relation between blocks. The default Master/Detail triggers enforce coordination between records in a detail block and the master record in a master block. On-

Check-Delete, On-Clear-Detail, On-Populate-Details are the triggers in this category.

 Message handling triggers

Oracle Forms automatically issues appropriate error and informational messages in response to runtime events. Message handling triggers fire in response to these default messaging events. On-Eror, On-Message are the triggers in this category.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 20

Overview of Trigger categories.. Cont..

Chapter 5

 Navigational triggers

 These triggers fire in response to navigational events. For example when the operator clicks on a text item in the next block, navigational events occur, as Oracle forms moves the input focus from the current item to the target item.

 These triggers are further sub-divided into two categories Pre- and Post- triggers and

When-New-Instance triggers.

 Preand Posttriggers fire as Oracle Forms navigates internally through different levels of the object hierarchy.

Pre-Form, Pre-Block, Pre-Record, Pre-Text-Item, Post-Text-Item, Post-Record, Post-Block and Post-Form is the sequence inside the navigation trigger sequence.

 Query-Time Triggers fire just before and after the operator executes a query in a block.

 When-New-Instance triggers fire at the end of a navigational sequence that places the input focus in a different item. Specifically, these triggers fire just after the Oracle Forms moves the input focus to a different item, when the form returns to a quiet state to wait for operator input.

When-New-Form-Instance, When-New-Block-Instance, When-New-Record-Instance and

When-New-Item-Instance are the triggers in this category.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 21

Overview of Trigger categories.. Cont..

Chapter 5

 Transactional Triggers

 These triggers fire during the Transaction process . Specifically these triggers are used to replace the default dml transaction processing, or add functionally to the

Transaction Processing.

 These trigger fire in response to a wide variety of events that occur as a Form interacts with the database. These triggers are defined at form or block levels only.

 Pre-insert, Pre-Delete, On-Insert, On-Delete, Post-Database-Commit, Post-Forms-

Commit are some examples of the Transactional trigger types.

Validation Triggers

These triggers fire during the Validate the item process . Specifically these triggers fire as the last part of item validation for items with the new or changed validation status.

 The commands allowed in these triggers are SELECT statements, unrestricted built-ins.

Examples of these triggers are When-Validate-Items, When-Validate-Record etc.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 22

Chapter 6: Alerts and Editors

 Alerts

 An Alert is a modal window that displays a message notifying the operator of some application condition. Alerts are generally used to advise operators of unusual situations or to warn operators who are about to perform an action that might have undesirable or unexpected consequences.

 Styles of Alerts are Stop , Caution and Note . Each style denotes different level of severity level. Forms runtime messages are ranked by Severity. Message severity is represented visually by a unique icon that is displayed in the alert window.

When an event occurs that causes an alert to display, the operator must respond to the alert’s message by selecting one of the pre-defined alert button. Selecting any button immediately dismisses the alert.

 Creating an Alert

 In the object Navigator, select the Alerts node, choose Navigator | Create .In the properties window, set the Alert Style property to the style that corresponds to the severity of the message : Stop , Caution or Note . Set the message property by entering the message that need to be displayed at runtime.

 Define one or more buttons for the alert by entering a text label in the Button1 label property field. Choose the default alert button from the defined buttons.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 23

Displaying an Alert Chapter 6

 Displaying an Alert

 To display an Alert, application must execute the SHOW_ALERT built-in subprogram which returns numeric value, from a trigger or user-named subprogram.

 The constant returned by the SHOW_ALERT function indicates which of the Button selected by the operator.

 Changing the Alert Message at Runtime

 To change an alert message at runtime by executing the SET_ALERT_PROPERTY built-in procedure.

 Set_alert_property (<alert_id>, <property>, “Message”) is the syntax, alert_id is an identifier of type ‘ALERT’, returned by the Find_Alert function, to which name of the

Alert is passed as parameter.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 24

Chapter 7: LOVs and Record Groups

 LOV (List of Value) : is a scrollable popup window that provides the user with either a single or multi-column selection list.

 LOVs can be displayed by user’s request, or

When the user navigates to a text item with an associate LOV, or

 Programmatically independent of any specific text item.

 LOV auto reduction and search features allow user’s to locate specific values. Oracle

Forms reduces the list to only those values that match the string being entered by comparing to the values in the first column.

 LOVs are derived from record groups.

LOVs that are selected by the user can be assigned to Form items according to the return items designated.

 At design time, a LOV can be attached to one or more text items in the Form.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 25

Creating LOV Chapter 7

 Creating LOV : As LOV values are derived from Record Group, to create LOV, first

Record Group is created and this is to be associated to a LOV.

The Record Group values can be from one of the following two sources:

The execution of a select statement that is associated with the Record Group at design time (query Record Group).

 An array of static values that are associated with the Record Group at design time

(static Record Group).

 While creating a LOV, specify which of the columns in the underline Record Group should be displayed in the LOV window.

And designate a return item for any column that is included in the LOV.

Because LOVs and Record Groups are separate objects, multiple LOVs can be created based on the same Record Group.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 26

Creating a LOV using the LOV wizard Chapter 7

 To create an LOV using the LOV wizard:

 In the Object Navigator, click the LOV node. Click the create button in the toolbar. In the new LOV dialog, choose use the LOV wizard.

Use the LOV wizard to create an LOV based on an existing query Record

Group, or a new query Record Group (which you will create during the wizard process), or an existing static Record Group. To create LOV based on a new static Record Group, first create the new static Record Group and then use the LOV wizard to create the LOV.

While creating LOV based on a new query Record Group, enter the SQL query in the Query Text field. To import SQL query from a file, click the

Import SQL Query button.

 In column mapping properties of the LOV, column title, return item and display width of the fields can be specified.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 27

Displaying a LOV at Runtime Chapter 7

 Once having defined an LOV, specify how it should be at runtime.

 LOV can also be display programmatically by writing a trigger or user-named routine that executes the SHOW_LOV or LIST_VALUES built-in subprogram.

To attach an LOV programmatically at runtime to a text item.

SET_ITEM_PROPERTY (‘<Text-Item-Name>’,LOV_Name,’<lov-Name>’):

 To find out which LOV is attached to text item, call in GET_ITEM_PROPERTY

(‘<Text-Item-Name>’,. LOV_Name).

 To know whether a text item currently has an LOV attached, call

GET_ITEM_PROPERTY (‘<Text-Item-Name>’,. LIST).

 To set the new Record Group to the LOV, call SET_LOV_PROPERTY (‘<lovname>’,GROUP_NAME,’<new_group>’).

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 28

Chapter 8: Master/Detail Relationship

 A Master/Detail relationship is an association between two base table blocks, the Master block and Detail block.

The relationship between the blocks reflect a primary key to foreign key between the tables on which the blocks are based.

 The Master/Detail relationship automatically does the following:

 Ensures that the Detail block displays only those records that are associated with the current (Master) record in the Master block.

 Co-ordinates querying between the two blocks.

 The Master block is related to the Detail block though the Join Condition.

The Join Condition establishes the primary key item(s) in the Master block and the foreign key item(s) in the Detail block.

 The block co-ordination involves the following phases.

 The clear phase: Oracle Forms Navigate internally to detail block and flushes the obsolete

Detail record.

 The population phase: Oracle Form issues a select statement to repopulate the Detail block with the Detail records associated with new Master record.These operations are accomplished through the execution of triggers.

CSC Proprietary 4/11/2020 1:53:42 AM 008_fmt_wht 29

Creating a Relation Chapter 8

 Master/Detail form can be build either by creating the relations between a master and a detail block explicitly or by using the Data Block wizard.

Creating a Master-Detail form module using the Data lock wizard :

Create the Master block in the same way as any other data block is created. From the Object Navigator, invoke the Data Block wizard. Follow the same steps as before to create a new Data Block in the Data Block wizard, until Master-Detail

Relationships creation or Deletion page arrives.

 Click on Auto-Join checkbox and then click to Create Relationships.

Select Master Bloc from the Data Block dialog box and click OK. The Data block wizard automatically creates the join condition between the master block and the detail block. This is displayed in the join condition field and the name of the master block is displayed in the Master Data block field.

 It is important t note that the Auto-Join condition data blocks check box should not be clear otherwise this wizard does not auto create the condition between the detail and master data blocks.

Click Next and Finish the Data Block wizard steps.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 30

Creating a Relation …contd… Chapter 8

 Creating a Master-Detail Relation in the Object Navigator:

 Relationship can be defined between two existing blocks by creating a relation object in the Object navigator.

In the Object Navigator, locate the block that is to be the master block in the relation, position the cursor on the Relation node under the master block and then select Navigator | Create. The New Relation dialog appears.

 Name of the master block selected appears in the Master block Field. In the Detail

Block field enter the name of the detail block.

To specify the Join Condition, an item name exist in both the Master and Detail blocks which can be equated.

 A combination of item name can exist with equating conditions which are called

Compound Joints.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 31

Property Of Relationship Chapter 8

 Master Deletes Property: Allows to specify how the deletion of a record in the Master block should affect records in the Detail block. These can be non-isolated, isolated or cascading.

Non-Isolated is the default setting, which prevents the deletion of a Master record if associated Detail record exist in the database. Isolated: When deleted in the Master record does not effect the associated Detail records in the database.

 Cascading allows the Master record to be deleted and automatically deletes any associated Detail records from the base table at commit time.

 Co-ordination Properties: Co-ordination of the Detail block its Master can be immediate, deferred with auto query or deferred with non-auto query.

Immediate: (Deferred False, Auto-Query False) When a co-ordination causing event occurs the Detail records are fetched immediately.

 Deferred With Auto-query: (Deferred True, Auto-Query True) When a coordination-causing events occurs, Oracle Forms fetching the associated detail records until the operator navigates to the detail block.

Deferred With No Auto-query: (Deferred True, Auto-Query False) When a coordinationcausing events occurs, Oracle Forms does not automatically fetch the detail records. To fetch the detail records, the operator must navigate to the detail block and explicitly execute a query.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 32

Property Of Relationship ..contd..

Chapter 8

 When a Relation is created, Oracle Forms sets the copy value from item property on the foreign key items in the detail block automatically. The copy value from item property specifies the name of the corresponding primary key item in the format Master_Block. Item_Name.

 At runtime, the value stored in the primary key item in the Master block is copied to the foreign key item in the Detail block When ever a detail record is created or queried.

Preventing Masterless Operation In The Detail Block: On setting Prevent

Masterless Operation Property to YES it prevents operator from performing

Masterless Operations in the Detail block of the relation.

 Master Details Triggers: Oracle Forms generates different triggers depending on the Master deletes and coordination properties that are set on the relationship.

For non-isolated deletes property, on-Check-Delete-Master, On-Clear-

Details, On-Populate-Details are created. For cascading and isolated deletes property, On-Clear-Details, On-Populate-Details are created.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 33

Chapter 9: Libraries

 A library is collection of subprograms, including user-named procedures, functions and packages. Libraries provide a convenient means of storing client-side program units and sharing them among multiple applications.

 The library .PLL file contains both library source code and the compiled, platformspecific executable code.

 User-named Subprograms

 Subprograms are PL/SQL functions or procedures are written in different Form modules.

Triggers are the primary way to add programmatic control to an Oracle Forms application.

 User-named subprograms supplement triggers by allowing to reuse code without having to enter it in multiple triggers.

 Creating a User-Named subprogram:

 Procedures: Is a named PL/SQL block which can take parameters and be invoked.

A procedure has two parts: the specification and the body.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 34

Libraries …contd… Chapter 9

 PL/SQL packages: A package is a PL/SQL construct that groups logically related types, objects, procedures and functions.

Form Builder provides several predefined packages that can be used.

Creating a Library

 In the Navigator, choose File/New/Object Library or Select the Libraries node and then choose Navigator/Create.

 To create a program unit, expand the desired library node, select the Program Units node, and then choose Navigator/Create. The New Program Unit dialog appears.

 Specify the program unit Name and its Type and then Choose OK. The PL/SQL Editor appears.

In the PL/SQL Editor, define the program unit and then choose Compile to compile.

Choose Close to dismiss the editor.

 Choose File/Administration/Compile File to compile any uncompiled library program units.

 Choose File/Save to save the library module to a file or to the database.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 35

Libraries …contd… Chapter 9

 Attaching a Library to Another Module

 In the Navigator, open the desired forms, menu or library module. To open a module, choose File/Open and then specify the module type to Open.

Expand the module and then select the Attached Libraries node and choose

Navigator/Create to attach a library.

 Specify the name of the library to be attached.

 Save the active Form or menu module to incorporate the library attachment in the module definition.

 SmartClass: It is an oject in object library used frequently in a class.

It can be applied easily and rapidly to existing objects.

It can be difined in many object libraries.

 You can have many Smartclasses of a given object type.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 36

Creating a SmartClass

 Creating a SmartClass

 Choose Tools/Object Library to display the Object Library.

In the Object library, click the desired object.

Choose Object/SmartClass.

Creating an Object based on a SmartClass

 In the Object Library, click the desired SmartClass.

 Drag the SmartClass to the desired module and the node.

 Applying a SmartClass to an existing Object

 In the Object Navigator, click the desired object.

 Click the right mouse button to display the pop-up menu.

Chapter 9

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 37

Subclassing an Object from the Library Chapter 9

 Subclassing an Object from the Library: You can do this in two ways

 First, you can use the subclass information property of the object to select a parent object from the object library. For eg. If you create a text item and want to make It a subclass of the number object in the Standard. OLB object library, you can click on the Properties

More button and see the subclass information dialog box.

 The second way to subclass from a library is to use the new SmartClass feature. A

SmartClass is a class in your library that you choose to make it available through a popup menu. You can make any object in your library a SmartClass.

Open the object library and select the object you wish to make into a SmartClass in the Object Library Editor.

 Choose Object/SmartClass Menu item from the Main menu of the Form Builder. You see a check mark appear next to an object in the Object Library Editor.

 Select an object in the Object Navigator of the same type as the SmartClass object.

 Right click on the object and choose the SmartClass menu item. You can see a submenu that lists all SmartClasses in open libraries of the same type of object as the0object you right clicked.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 38

Chapter 11: Form Parameters

 Form Parameters : A simple mechanism for defining And setting the values of inputs that are required by a form. Form parameters have different uses depending upon the context like passing the parameter from user when form requires certain parameters at startup time, passing certain parameter from one form to another form, passing form parameters to generate reports.

 Form parameters must be defined at design time before they can specify a value for it at form startup. That is, the form must be expecting the parameter value it receives at startup.

Creating and Passing Parameters :

To create Parameter, select parameter node in the Navigator, and then choose Navigator

 Create, in the properties window, set the desired parameter properties.

 Referencing Parameters : In PL/SQL, form parameters can be referenced and set values of using bind variables. To reference a parameter preface the parameter name with the reserved word PARAMETER.

 PARAMETER.parameter_name := ‘Hyderabad’;

Or

:block.item := :PARAMETER.parameter_name;

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 39

Parameter Lists Chapter 11

 Parameters cannot be passed directly in triggers, user-named routines, menu commands, or stored procedures that is not declared in the same module as the parameter itself. In this context we need Indirectly Referencing Parameters.

 Indirectly Referencing Parameters : In this method Parameters are passed to called forms by means of a parameter list. A parameter list is a named programmatic construct that is simply a list of parameter names (called keys) and their values. A parameter that can be included in a parameter list can be either text parameter or data parameter.

Parameter types that can be included in a Parameter List can be either text parameter

(TEXT_PARAMETER) or data parameter (DATA_PARAMETER ).

 In creating and manipulating Parameter List the following built-in programs can be used

 CREATE_PARAMETER_LIST : to create a parameter list. This returns a id.

Ex. Create_Parameter_list(‘list_name’);

 ADD_PARAMETER : To add parameters to the list. Syntax :

Add_Parameter(Param_list_id, Key_name, Type, Value).

SET_PARAMETER_ATTR :To set the type and value of a parameter that has been created.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 40

Parameter Lists … contd… Chapter 11

 GET_PARAMETER_ATTR :To get the type and value of a parameter that has been created.

GET_PARAMETER_LIST : To get the ParamList Id of an indicated parameter list.

Syntax : Get_Parameter_List( ParamList).

 DELTE_PARAMETER : To delete a parameter from the ParamList.

 DESTROY_PARAMETER_LIST : To delete the Parameter List.

 While creating parameter list first declare a variable of type ParamList to store the parameter list ID.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 41

Chapter 12:Canvas-Views and Windows

 A canvas is a surface inside a window container on which you place the interface items and boilerplate objects that end users interact with when they run the form.

Each Canvas-View is displayed in a Windows.

The Windows object, by itself, is an empty frame.

 The frame provides a title bar and handles for interacting with the Windows, making t possible for operators to scroll, move and resize the Windows.

 We specify the relationships between items, Canvas-Views and Windows by setting their properties.

 Each item has a Canvas property that specifies the canvas on which the item is displayed.

Each Canvas-Vies, in turn, has a Window property that specifies the Windows in which

It will be displayed.

 We must assign at least on Canvas-View to each Window in a form.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 42

 Form Builder provides four types of canvases, Content, Stacked, Tab and Toolbar.

 Content Canvas

: It’s the base view that occupies the entire content pane of the Window in which it is displayed. At least one content Canvas-view for each Window. Only one of the content canvas will be shown in the window at runtime when there are multiples

Content canvases.

 Properties specific to content canvas are Window, Viewport X Position on canvas,

Viewport Y Position on canvas, Width, Height and Bevel.

 Stacked Canvas : A stacked canvasview is displayed in a window on top of or “stacked” on the content canvas-view and are often shown and hidden programmatically.

Tab Canvas : A tab canvas is a canvas by which you display related information on separate tables. Tab canvas are displayed on top of content canvases.

 Properties specific to tab canvas are viewport X position, viewport Y position, viewport width,viewport height, tab style, tab attachment edge, canvas, tab page.

 Toolbar Canvas-Views : are used to create toolbars for individual windows. Horizontal toolbars are display at the top of a window, just under its menu bar. Vertical toolbars are displayed along the left side of a window.

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 43

Chapter 13:Menus

Menu Module: A menu module is a hierarchically structured object that provides a quick and easy method for operating your Forms application. Like the from module, the menu module is one of the main components of an application.

• Menus: A menu is a list of related options. Each option performs a different action.

You can create three menu types in forms:

• Main Menu

– Displays horizontally in the menu bar

Contains options (menu items) that are typically individual manus

Individual Manu

Displays vertically

Submenu

– Displays vertically

CSC Proprietary 4/11/2020 1:53:43 AM 008_fmt_wht 44

Menu Item: A menu item is an option that you can choose from a menu. Each menu item has an associated command that enables the user to perform an action.

Menu Toolbar: A menu toolbar is a toolbar of iconified buttons that represent some individual items from your form menu. For a menu module, you can have a vertical and a horizontal menu toolbar.

• Menu Style

• Pull-Down Manu: A Pull-down menu comprises a set of options, displayed horizontally under the application window title. Each option can represent a submenu or an action.

Selecting a submenu displays a vertical list. Selecting an action executes the action.

Full-screen Menu: A full screen menu displays each menu in a separate window, Only the current item is highlighted, and the Enter Your Choice field contains the chosen menu item number. Full Screen menus are commonly used in character-mode applications and are rarely used for bitmapped applications.

CSC Proprietary 4/11/2020 1:53:44 AM 008_fmt_wht 45

Bar Menu: A bar menu displays options horizontally under the application window title line, but unlike the pull-down menu, when you select an item, the submenu replaces the previous one, horizontally.

• Every Form runs with one of the following

The Default menu that is built in every Form.

• A customer menu that you define as a separate module and then attach to the form for runtime execution.

• No menu at all.

At runtime, an application can have only one menu module active at a time, either the

Default menu or a Customer menu.

• To explicitly specify the Default menu

Select the form module in the Navigator.

– In the Property palette, set the Menu Module property to DEFAULT&SMARTBAR.

If you want the form to run without a menu, leave the Menu Module field blank.

CSC Proprietary 4/11/2020 1:53:44 AM 008_fmt_wht 46

Class room exercise

 At the “Welcome to Form

Builder” Screen, make sure the “Use the Data Block

Wizard” is selected and click

“OK”.

 At the initial screen click

Next.

 Make sure Table View is selected and choose Next.

 At this Screen select the

Browse Option.

 A Connect screen will then appear.

 Enter your User Name,

Password and Database that you were given for your

Oracle Accounts.

CSC Proprietary 4/11/2020 1:53:44 AM 008_fmt_wht 47

Class room exercise cont…2

 At the Tables window, Choose Current User and Ok.

 At the next Tables window, double click on the table you wish to create a form for.

 The Table and its fields will appear.

 If this is the wrong table click back and repeat from browse option.

 Move all fields you wish to include in your

Form to the right side.

 After clicking Next, you will see the congratulations screen.

 Highlight the “Create the Data Block and Call

Layout Wizard” button and select finish.

CSC Proprietary 4/11/2020 1:53:44 AM 008_fmt_wht 48

Class room exercise cont…3

 Select Next at the initial two screens.

 Next, Select all fields you wish to include and move them to the right column

 At this field you may edit the name and size of your attributes, but the defaults match your table definitions.

 When finished select Next.

 Select Forms and Click Next.

 Title your record and Choose one Record to be displayed and click next.

 Then Click Finish at the Congratulations

Screen

CSC Proprietary 4/11/2020 1:53:44 AM 008_fmt_wht 49

Class room exercise cont…4

Select Forms and Click Next

Title your record and Choose one Record to be displayed and click next

Then Click Finish at the Congratulations Screen

In some instances you will want multiple tables in your form.

– First, if your runtime screen is open, close it to get back to Developer.

– To add an additional table, go to the Tools menu then to Data Block

Wizard.

CSC Proprietary 4/11/2020 1:53:44 AM 008_fmt_wht 50

Class room exercise cont…5

 After you choose the additional table, it will prompt you to make a join to the current table.

 To create a join:

– Uncheck the “Auto-join data blocks” box

– Click “Create Relationship…”

– Make sure the “Based on a join condition” radius is marked and click OK

– Choose the master table and click OK

– Match the Detail Item with the Master Item then click next.

CSC Proprietary 4/11/2020 1:53:44 AM 008_fmt_wht 51

Class room exercise cont…6

 A window similar to this one will next appear.

 You may drag and edit the fields in this window.

 Change font, size, height, width, location, etc.

 You may also add triggers and specialized actions to the form using PL/SQL

 Click the green stop light to run the

Form (Forms Runtime)

CSC Proprietary 4/11/2020 1:53:44 AM 008_fmt_wht 52

Class room exercise cont…7

 You will now see your Form appear.

 To get to the next record, click the forward blue arrow

 When finished, click on the Open

Teal Door and Save Changes

 This will update your Oracle account adding all new records to your tables

CSC Proprietary 4/11/2020 1:53:44 AM 008_fmt_wht 53

Download