Les04

36
4 Copyright © Oracle Corporation, 2002. All rights reserved. Creating a Basic Form Module

description

 

Transcript of Les04

Page 1: Les04

4Copyright © Oracle Corporation, 2002. All rights reserved.

Creating a Basic Form Module

Page 2: Les04

4-2 Copyright © Oracle Corporation, 2002. All rights reserved.

Objectives

After completing this lesson, you should be able to do the following:• Create a form module• Create a data block• Modify a data block• Modify the layout• Save and compile a form module• Identify Forms file formats and their

characteristics• Explain how to deploy a form module• Create data blocks with relationships• Run a master-detail form module

Page 3: Les04

4-3 Copyright © Oracle Corporation, 2002. All rights reserved.

Create data blocks and items

Apply standards

Fine-tune layout

Set object properties

Add code

Creating a New Form Module

Test form module

Create an empty module

Page 4: Les04

4-4 Copyright © Oracle Corporation, 2002. All rights reserved.

Creating a New Form Module

Choose one of the following methods:

• Use wizards:– Data Block

Wizard– Layout Wizard

• Build modulemanually

• Use template form

Page 5: Les04

4-6 Copyright © Oracle Corporation, 2002. All rights reserved.

Form Module Properties

Nameproperty

CoordinateSystemproperty

Page 6: Les04

4-8 Copyright © Oracle Corporation, 2002. All rights reserved.

Creating a New Data Block

• Use Forms 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

Page 7: Les04

4-9 Copyright © Oracle Corporation, 2002. All rights reserved.

Creating a New Data Block

Enter datasource

Launch LayoutWizard

Lay out datablock contents

New Data Block

Reentrant mode

Reentrant mode

Launch DataBlock Wizard

Page 8: Les04

4-10 Copyright © Oracle Corporation, 2002. All rights reserved.

Navigating the Wizards

Exit without saving

Invoke online help

Savewithout exiting

Saveand exit

Previousscreen

Nextscreen

Available onlyin reentrant mode

Tabbed Interface:Available only in reentrant mode

Page 9: Les04

4-11 Copyright © Oracle Corporation, 2002. All rights reserved.

Launching the DataBlock Wizard

In Forms Builder, do one of the following:• Select Tools > Data Block

Wizard.• Right-click and select Data

Block Wizard.• Select the Data Blocks node

and click Create icon; select Use the Data Block Wizard

option.• Use the Data Block Wizard

button on the toolbar in the Layout Editor.

Page 10: Les04

4-12 Copyright © Oracle Corporation, 2002. All rights reserved.

Data Block Wizard: Type Page

Page 11: Les04

4-13 Copyright © Oracle Corporation, 2002. All rights reserved.

Data Block Wizard: Table Page

Page 12: Les04

4-15 Copyright © Oracle Corporation, 2002. All rights reserved.

Layout Wizard: Items Page

Page 13: Les04

4-16 Copyright © Oracle Corporation, 2002. All rights reserved.

Layout Wizard: Style Page

Page 14: Les04

4-17 Copyright © Oracle Corporation, 2002. All rights reserved.

Layout Wizard: Rows Page

Page 15: Les04

4-18 Copyright © Oracle Corporation, 2002. All rights reserved.

Data Block Functionality

Once you create a data block with the wizards, Forms 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

• Triggers needed to enforce database constraints if “Enforce data integrity” is checked

Page 16: Les04

4-19 Copyright © Oracle Corporation, 2002. All rights reserved.

Modifying the Data Block

• Reentrant Data Block Wizard:1. Select frame or object in Layout Editor,

or data block or frame in Object Navigator

2. Select Tools > Data Block Wizard OR

Right-click and select DataBlock Wizard OR

Click Data Block Wizard

• Object Navigator: – Create or delete items– Change item properties

• Block Property Palette: Change property values

Page 17: Les04

4-20 Copyright © Oracle Corporation, 2002. All rights reserved.

Modifying the Layout

• Reentrant Layout Wizard:– Select frame in Object

Navigator or Layout Editor– Select Tools > Layout Wizard

OR– Right-click and select Layout

Wizard OR– Click Layout Wizard

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

• Frame Property Palette: Change property values

Page 18: Les04

4-22 Copyright © Oracle Corporation, 2002. All rights reserved.

Template Forms

Page 19: Les04

4-23 Copyright © Oracle Corporation, 2002. All rights reserved.

Saving a Form Module

To save the form module:

• Select File > Save ORClick the Save icon

• Enter a filename

• Navigate to desired location

• Click Save

Page 20: Les04

4-24 Copyright © Oracle Corporation, 2002. All rights reserved.

Compiling a Form Module

1

32

4

Page 21: Les04

4-25 Copyright © Oracle Corporation, 2002. All rights reserved.

Module Types and Storage Formats

.fmb .fmx .fmtForm Module

.mmb .mmx .mmtMenuModule

.pll .plx .pldPL/SQLLibrary

.olb .oltObjectLibrary

Page 22: Les04

4-27 Copyright © Oracle Corporation, 2002. All rights reserved.

Deploying a Form Module

1. Move module files to middle tier

2. Generate module on middle tier

3. Run in browser using9iAS Forms Services on middle tier

.fmb

.fmx

1 2

3

Page 23: Les04

4-28 Copyright © Oracle Corporation, 2002. All rights reserved.

Text Files and Documentation

• Convert a binary file to a text file.

• Create an ASCII file for a form module.

Page 24: Les04

4-29 Copyright © Oracle Corporation, 2002. All rights reserved.

Practice 4-1 Overview

This practice covers the following topics:

• Creating a new form module

• Creating a data block by using Forms Builder wizards

• Saving and running the form module

Page 25: Les04

4-30 Copyright © Oracle Corporation, 2002. All rights reserved.

Form Block Relationships

Master

Detail

Master

Detail Master

Detail

Master

Detail Detail

Page 26: Les04

4-31 Copyright © Oracle Corporation, 2002. All rights reserved.

Form Block Relationships

Orders

Items

Customers

Orders

Items

Customers

Orders Account Rep

Page 27: Les04

4-32 Copyright © Oracle Corporation, 2002. All rights reserved.

Data Block Wizard: Master-Detail Page

Page 28: Les04

4-34 Copyright © Oracle Corporation, 2002. All rights reserved.

Relation Object

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

• Default name assigned: MasterDataBlock_DetailDataBlock

• Triggers and program units generated automatically

Page 29: Les04

4-35 Copyright © Oracle Corporation, 2002. All rights reserved.

Creating a Relation Manually

Page 30: Les04

4-36 Copyright © Oracle Corporation, 2002. All rights reserved.

Join Condition

• The join condition creates primary-foreign key link between blocks

• Define a join condition using:– Block and item names (not table and column

names)– SQL equi-join syntax

Page 31: Les04

4-37 Copyright © Oracle Corporation, 2002. All rights reserved.

Deletion Properties

Isolated

Cascading

NonisolatedNo Detail Rec

NonisolatedDetail Rec

= Deleted

Master-DetailRecords

Page 32: Les04

4-39 Copyright © Oracle Corporation, 2002. All rights reserved.

Coordination Properties

Default Deferredwith auto query

Deferredwithout

auto query

Page 33: Les04

4-40 Copyright © Oracle Corporation, 2002. All rights reserved.

Running a Master-Detail Form Module

• Automatic block linking for:– Querying– Inserting

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

Page 34: Les04

4-41 Copyright © Oracle Corporation, 2002. All rights reserved.

Summary

In this lesson, you should have learned that:

• To create a form module, you create an empty module, then add data blocks and other elements

• You can create a data block manually or with the Data Block Wizard and Layout Wizard

• You can modify a data block manually or with the Data Block Wizard in reentrant mode

• You can modify the layout manually or with the Layout Wizard in reentrant mode

• You can save and compile a form module using the File and Program menus or from the toolbar

Page 35: Les04

4-42 Copyright © Oracle Corporation, 2002. All rights reserved.

Summary

• You can store form, menu, and library modules in text format, in a portable binary format, or anon-portable binary executable format

• To deploy a form module, you move it to the application server machine and generate it

• You can create data blocks with relationships by using the Data Block Wizard or by manually creating a Relation object

• When you run a master-detail form, block coordination is automatic depending on properties of the Relation object

Page 36: Les04

4-43 Copyright © Oracle Corporation, 2002. All rights reserved.

Practice 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