+ All Categories
Home > Documents > Oracle 10g: Forms Builder I

Oracle 10g: Forms Builder I

Date post: 16-Feb-2022
Category:
Upload: others
View: 55 times
Download: 0 times
Share this document with a friend
97
PRINCE SULTAN UNIVERSITY 2012 Oracle 10g: Forms Builder I IS 333 – Information Systems Development Prepared by: Ms. Ghada Al-Mazroa | Supervised by: Ms. Roohi Jan C OMPUTER & I NFORMATION S CIENCES D EPARTMENT . C OLLEGE FOR W OMEN
Transcript

PRINCE SULTAN UNIVERSITY

2012

Oracle 10g: Forms

Builder I IS 333 – Information Systems Development

Prepared by: Ms. Ghada Al-Mazroa | Supervised by: Ms. Roohi Jan

C O M P U T E R & I N F O R M A T I O N S C I E N C E S D E P A R T M E N T . C O L L E G E F O R W O M E N

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 2

Oracle 10g: Forms Builder I 2012

Table of Contents How to Start Oracle Form Builder ...........................................................................................4

How does Forms Builder translate the form designer specification into a Java Applet ?........... 7

Exploring the Form Builder .....................................................................................................8

What is an Object Navigator? ...................................................................................................... 8

Definitions ................................................................................................................................. 10

Types of views ........................................................................................................................... 11

How to view a Form in a Run mode? ........................................................................................ 12

How to view information on database errors? ......................................................................... 13

Modifying FORM Properties ...................................................................................................... 14

Intersection mode ................................................................................................................. 16

Layout editor after changing the properties ......................................................................... 17

Ensuring a Consistent Appearance Across Form Modules ...................................................... 20

Why it is important to maintain a consistent look and feel? .................................................... 20

Two ways to standardize the appearance of multiple forms in an application: ....................... 20

Template Forms ................................................................................................................... 20

Steps to create the template form ............................................................................................ 20

Visual Attribute Groups ........................................................................................................ 36

Steps to create visual attribute group for form text items ....................................................... 36

Creating a Form Based on a Template Form .......................................................................... 40

Steps to create a new form using the template ........................................................................ 40

Applying The Visual Attribute Group to The Form Text Items ................................................ 53

Steps to apply the visual attribute group .................................................................................. 53

Referencing Application Components ................................................................................... 58

Using the Path Specification Approach ..................................................................................... 58

Global Path Variable .............................................................................................................. 58

Opening and Closing Forms in an Integrated Database Application ........................................ 59

Steps to create a Home Page form using the template ............................................................ 59

Opening forms in an Integrated Database Application ............................................................. 65

CALL_FORM ........................................................................................................................... 65

OPEN_FORM .......................................................................................................................... 66

NEW_FORM ........................................................................................................................... 67

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 3

Oracle 10g: Forms Builder I 2012

Closing forms in an Integrated Database Application ............................................................... 71

CLOSE_FORM ......................................................................................................................... 72

EXIT_FORM ............................................................................................................................ 72

Creating Triggers to Open/Close Forms .................................................................................... 72

Creating a Log-In Page .......................................................................................................... 73

Steps to create a Log-In Page form using the template ............................................................ 73

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 4

Oracle 10g: Forms Builder I 2012

How to Start Oracle Form Builder

1. Run the database script in SQL+

2. Start OC4J Instance (leave it on the side, don’t close it).

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 5

Oracle 10g: Forms Builder I 2012

3. Disable the proxy (step 2 & 3 are needed to run a form)

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 6

Oracle 10g: Forms Builder I 2012

4. Start the forms builder

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 7

Oracle 10g: Forms Builder I 2012

How does Forms Builder translate the form designer specification into a

Java Applet ?

It uses a Web server process called an Oracle9iAS Containers for J2EE, or (OC4J)

Instance.

When developing, workstation runs web server and web browser in its main

memory.

Form Builder development environment compiles the form design file ( .fmb) to a

file (.fmx) and send the complied .fmx file to the OC4J Instance, which inturn

translates the compiled .fmx file into a Java applet and then downloads the Java

Applet to your web browser.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 8

Oracle 10g: Forms Builder I 2012

Exploring the Form Builder

What is an Object Navigator?

Click File, Open, select CUSTOMERDEMO (an example of a previously created & saved form)

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 9

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 10

Oracle 10g: Forms Builder I 2012

Definitions

Block :

o A block is a structure that contains a group of objects such as text fields

or command buttons or option buttons

Data Block :

o A data block is a block that is associated with a database table. When you

create a data block using wizard, the system automatically generates the

text items and labels for data fields in that table and provides the code

for inserting, modifying, deleting and viewing data records.

Data block form: one or more data blocks

Text items: most common block items which display text data values in text

fields

Window :

o Rectangular area on a computer screen that has a title bar at the top.

o Windows have horizontal and vertical scroll bars.

o Windows can be resized, maximized and minimized.

Canvas :

o A canvas is the area in a window in which you place graphical user

interface ( GUI) objects, such as buttons and text fields.

Items : are form objects that a user sees and interacts with on the canvas.

Trigger : A Trigger is a PL/SQL program that starts in response to an event. An

event is a response to a user or system action, such as clicking a button or

loading a form, that occurs in a window application.

Relation : A relation is a form object that Forms builder creates for a form that

displays two data blocks whose underlying database tables have a foreign key

relationship.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 11

Oracle 10g: Forms Builder I 2012

Types of views 1. Ownership view :

a. Presents the form as the top level object and then list all form object nodes

on the next level. In this view, data blocks, canvases and windows all appear

as objects directly below the form module.

b. The object Navigator does not show hierarchical relationships among

windows, canvases and blocks.

c. It shows which items are in a specific block.

d. It is useful for quickly accessing specific objects without having to open all of

the higher level objects.

2. Visual view :

a. Presents how form objects contain other objects i.e. a form contains

window, a window contains canvases, and a canvas contains data block.

b. Visual view does not show data block.

c. It is useful for viewing and understanding form object relationship.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 12

Oracle 10g: Forms Builder I 2012

How to view a Form in a Run mode?

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 13

Oracle 10g: Forms Builder I 2012

How to view information on database errors?

Click Help menu, Display Error

Dialog box displays error information

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 14

Oracle 10g: Forms Builder I 2012

Modifying FORM Properties

Property Palette of Windows

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 15

Oracle 10g: Forms Builder I 2012

Property Palette of Frame

Property Palette of Text Item

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 16

Oracle 10g: Forms Builder I 2012

Intersection mode

We can use property palette in intersection mode to modify one or more properties of a group

of objects so that all objects in the group have the same value or values.

Indicates is in

intersection mode

Objects have the

same value

Objects have the

different value

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 17

Oracle 10g: Forms Builder I 2012

Layout editor after changing the properties

Change the font

properties of all the

items

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 18

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 19

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 20

Oracle 10g: Forms Builder I 2012

Ensuring a Consistent Appearance Across Form Modules

Why it is important to maintain a consistent look and feel?

Different form developers usually work on one single database, therefore they

may be not consistent

To make the forms appear as a polished and integrated application

To speed up the form development process as you don’t need to do it from

scratch

To reduce user training time and frustration

Two ways to standardize the appearance of multiple forms in an

application:

1. Use template forms

2. Use visual attribute groups

Template Forms

It is generic form that includes standard form objects that appear in every form

in an application, (e.g. graphics, command buttons, and program units)

Ensures a uniform overall appearance for application forms

You store the template form in a location that is accessible to all developers.

In this manual, we’ll create a template form for the Northwoods University database.

Steps to create the template form

1. Have a design in your mind or as sketch of how you’d like the template to look

like

Logo

Return

Northwoods

University

Oracle

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 21

Oracle 10g: Forms Builder I 2012

2. In the Object Navigator, select the MAIN node, and then click the Collapse All

button to collapse the MAIN form objects.

3. Select the top level Forms node, and then click the CREATE button to create a

new form. Change the form module name to NORTHWOODS_TEMPLATE.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 22

Oracle 10g: Forms Builder I 2012

4. To create the new canvas, select the Canvases node and then click the Create

button. Change the canvas name to TEMPLATE_CANVAS.

5. To configure the template window, open the Windows node, and change the

form window name to TEMPLATE_WINDOW. Select the TEMPLATE_WINDOW

node, right-click, and then click PROPERTY PALETTE. Change the Title property

value to Northwoods University, and then close the Property Palette.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 23

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 24

Oracle 10g: Forms Builder I 2012

6. Save the form as NORTHWOODS_TEMPLATE.fmb in the

NorthwoodsProject_Done folder.

To create the canvas and add the template canvas objects:

7. In the Object Navigator, right-click the TEMPLATE_CANVAS node, and then click

Property Palette. Select the Background Color property, click the More button,

and then select a medium gray square. Then close the Property Palette.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 25

Oracle 10g: Forms Builder I 2012

8. Double-click the Canvas icon beside TEMPLATE_CANVAS to open the form

canvas in the Layout Editor.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 26

Oracle 10g: Forms Builder I 2012

9. To create the boilerplate Rectangle, select the rectangle tool on the tool palette,

and draw a rectangle that defines the area that contains the logo and return

button. The rectangle should start at the top-left corner of the canvas, and

should extend the entire length of the canvas. The rectangle’s bottom edge

should be even with the bottom edge of the canvas.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 27

Oracle 10g: Forms Builder I 2012

10. Select the rectangle if necessary, select the Fill Color tool on the tool palette,

and change the rectangle fill color to a lighter shade of gray than the canvas

background color. The filled rectangle should appear slightly lighter than the rest

of the canvas.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 28

Oracle 10g: Forms Builder I 2012

11. Make sure that the rectangle is still selected, select the Line Color tool on the

tool palette, and then click No Line.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 29

Oracle 10g: Forms Builder I 2012

12. To import the Northwoods University logo, click Edit on the menu bar, point to

Import, and then click Image. Click Browse, navigate to

NorthwoodsProject_DONE folder, select NWlogo.jpg, click Open, and then click

Ok. The logo appears on the canvas. Resize and reposition the logo.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 30

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 31

Oracle 10g: Forms Builder I 2012

13. To create the return button, select the Button tool on the tool palette, and draw

the button. Double-click the button to open its Property Palette, change the

button properties as follows, and then close the Property Palette:

Name RETURN_BUTTON

Label Return

Width 90

Height 16

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 32

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 33

Oracle 10g: Forms Builder I 2012

14. To create the button trigger, select the button, right-click, point to

SmartTriggers, and then click WHEN-BUTTON-PRESSED. Type the following

command, compile the trigger, debug it if necessary, and then close the PL/SQL

Editor.

EXIT_FORM;

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 34

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 35

Oracle 10g: Forms Builder I 2012

15. Click Window on the menu bar, and then click Object Navigator to open the

Object Navigator. Note that when you create the Return button, Forms Builder

automatically created a new control block that contains the button. Change the

new block name to TEMPLATE_BLOCK, and then save the form.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 36

Oracle 10g: Forms Builder I 2012

Visual Attribute Groups

A form object that defines object properties (e.g. text item colors, font sizes, and

font styles)

Ensures a standard appearance & properties for block items

You assign the visual attribute group after you create it, to Visual Attribute

Group property of form windows, canvases, and items.

Steps to create visual attribute group for form text items

1. In the Object Navigator window, select the Visual Attributes nodes under the

NORTHWOODS_TEMPLATE form module, and then click the Create button. A

new visual attribute group object appears.

2. Select the new visual attribute group, right-click, and then click Property Palette.

Change the Name value to TEXT_ITEM_VISUAL_ATTRIBUTES.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 37

Oracle 10g: Forms Builder I 2012

3. Make sure that the Visual Attribute Type property value is Common, which

means that the specified properties apply to all attributes in the object; while

Prompt apply only to object prompts, and Title apply only to object titles.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 38

Oracle 10g: Forms Builder I 2012

4. To specify that the text appears in a dark blue color, select the Foreground Color

property, click the More button , and then select a dark blue square.

5. To specify that the text appears on a white background, select the Background

Color property, click the More button, and type (or select) white in the property.

6. Select the Font Name property, click the More button, select Arial, and then

click OK. Select the Font Size property, delete the current value, and then type 8.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 39

Oracle 10g: Forms Builder I 2012

7. Close the Property Palette, save the form, and then close the form in the Forms

Builder.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 40

Oracle 10g: Forms Builder I 2012

Creating a Form Based on a Template Form Now, you can create a new form based on the Northwoods Template

Steps to create a new form using the template

1. In the Object Navigator, click File on the menu bar, point to New, and then click

Form Using Template. The Open dialog box opens, prompting you to select the

template form. Select the Northwoods_Template.fmb, and then click Open. A

new form appears in the Object Navigator. Note that the new form contains

objects in the Data Blocks, Canvases, and Visual Attributes nodes. These are the

objects that you created in the template form.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 41

Oracle 10g: Forms Builder I 2012

2. Change the form module name to LOCATION.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 42

Oracle 10g: Forms Builder I 2012

3. To create the new data block, select the Data Blocks node, click the Create

button, make sure the Use the Data Block Wizard option button is selected, and

then click OK. When the Data Block Wizard Welcome page appears, click Next.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 43

Oracle 10g: Forms Builder I 2012

4. When the Type page appears, make sure the Table or View option button is

selected, and then click Next. On the Source page, click Browse, select the

LOCATION database table, and click OK. Click the Move all items to target

button to select all of the table fields for the data block, leave the Enforce

data integrity check box cleared, and then click Next.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 44

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 45

Oracle 10g: Forms Builder I 2012

5. When the Master-Detail page appears, click Next because you do not want to

create a master-detail relationship. Accept LOCATION for the data block name,

and click Next. When the Finish page appears, make sure that the Create the

data block, then call the Layout Wizard option button is selected, and then click

Finish.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 46

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 47

Oracle 10g: Forms Builder I 2012

6. When the Layout Wizard Welcome page appears, click Next. Accept the default

values on the Canvas page, and then click Next. (Recall that you are basing the

new form on the template form, and the template form’s canvas name is

TEMPLATE_CANVAS.)

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 48

Oracle 10g: Forms Builder I 2012

7. On the Data Block page, click to select all of the data block fields for the

layout, and then click Next. On the item page, accept the default prompt values,

and then click Next.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 49

Oracle 10g: Forms Builder I 2012

8. On the Style page, make sure that the Form option button is selected, and then

click Next. On the Raw page, type Location for the frame title, leave the Records

Displayed value as 1, click Next, and then click Finish.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 50

Oracle 10g: Forms Builder I 2012

9. In the Layout Editor, the new data block objects are not visible because they

appear below the existing form template objects. Scroll to the bottom of the

window, select the Location frame, and drag it to the top of the canvas. Resize

the frame, and format the text item labels, so your form looks like the figure

below

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 51

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 52

Oracle 10g: Forms Builder I 2012

10. Save the form as Location.fmb in the NorthwoodsProject_DONE folder.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 53

Oracle 10g: Forms Builder I 2012

Applying The Visual Attribute Group to The Form Text Items

Steps to apply the visual attribute group

1. In the Layout Editor, select the LOC_ID text item, press and hold the Shift key,

and then select BLDG_CODE, ROOM, and CAPACITY, so all of the text items are

selected as an object group. You do not need to select the item prompts,

because their properties are defined with their associated text items.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 54

Oracle 10g: Forms Builder I 2012

2. Click Tools on the menu bar, and then click Property Palette to open the

intersection Property Palette for the text item object group.

3. Scroll down to the Visual Attributes property node, select the Visual Attribute

Group property, open the list, and select TEXT_ITEM_VISUAL_ATTRIBUTES.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 55

Oracle 10g: Forms Builder I 2012

4. Close the Property Palette, and save the form. Note that the form text items now

appear as a dark blue text on a white background, in an 8-point Arial Regular

font, as specified in the custom visual attribute group.

5. Run the form, click Enter Query button, and then click the Execute Query

button. Step through the table records to view the records, and then close the

browser window.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 56

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 57

Oracle 10g: Forms Builder I 2012

6. Close the LOCATION form in Forms Builder.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 58

Oracle 10g: Forms Builder I 2012

Referencing Application Components When you create an integrated database application, the main form application uses

program commands to open other form/report modules so that it can be served as a

single entry & exit point. There are two approaches for referencing application

components. One of them is:

Using the Path Specification Approach

Path specification approach includes: drive letter, folder path, and file name, including

the file extension. E.g.: C:\Documents and Settings\gmazroa\My Documents\NorthWoodsProject_DONE\LOCATION.fmx

Steps to use the path specification approach: refer to Step #2 in How to create a button

with a CALL_FORM procedure

Uses: for development team that has standardized procedures for saving all of the

project files to a specific location on a file server

Disadvantage: make it difficult to move the application to a different storage location

because you must change the path specifications in all commands that reference the

form or report files.

Solution: using Global Path Variable

Global Path Variable

A variable that references a text string specifying a complete path to the drive and

folder where you store all the application files

Advantage: enables you to place the path information in a single location. So that

whenever you move the application files to a new location, you only have to change the

specification in the global path variable, instead of changing it in many different

locations.

Syntax: :GLOBAL.variable_name := variable value

To use it: :GLOBAL.variable_name

Example: :GLOBAL.project_path := 'C:\Documents and Settings\gmazroa\My Documents\NorthWoodsProject_DONE\';

CALL_FORM(:GLOBAL.PROJECT_PATH || 'EXIT_PAGE');

Steps to use the global path variable: refer to How to create a Log-In Page form part.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 59

Oracle 10g: Forms Builder I 2012

Opening and Closing Forms in an Integrated Database Application We’ll create a Home Page, which serves as the entry and exit point for all other application

forms and reports. You can write commands for the switchboard buttons and menu selections

to call & close specific forms & reports.

Steps to create a Home Page form using the template

1. In the Object Navigator, click File on the menu bar, point to New, and then click

Form Using Template. The Open dialog box opens, prompting you to select the

template form. Select the Northwoods_Template.fmb, and then click Open. A

new form appears in the Object Navigator.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 60

Oracle 10g: Forms Builder I 2012

2. Change the form module name to HOME_PAGE.

3. Change the Data Block name to HOME_PAGE_BLOCK, Canvas name to

HOME_PAGE_CANVAS, and Window name to HOME_PAGE_WINDOW

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 61

Oracle 10g: Forms Builder I 2012

4. To edit the new form, right-click on HOME_PAGE, and then click on Layout

Editor.

5. In the Layout Editor, click on the Text button on the tool palette, and then draw

it in the middle of the form. To enter a welcome text, type Welcome to

Northwoods University Database.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 62

Oracle 10g: Forms Builder I 2012

6. To change the format of the welcome message, change the Font to Arial, the

Font Size to 16, make it Bold, and then move it if necessary.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 63

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 64

Oracle 10g: Forms Builder I 2012

7. Save the form as HOME_PAGE.fmb in the NorthwoodsProject_Done folder.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 65

Oracle 10g: Forms Builder I 2012

Opening forms in an Integrated Database Application

Forms Builder provides a number of built-in procedures that enable you to open one

form from another. The form that calls the second form is the parent form, and the form

that is called is the child form.

Procedure Name Description

CALL_FORM Opens a child form and immediately switches the application focus to the child form. Has options for hiding the parent form, displaying the menu from the parent form, and passing a parameter list from the parent form.

OPEN_FORM Opens a child form, with the option of not immediately changing the application focus to the child form. Has an option for creating a new database session for the child form or using the parent form’s database session.

NEW_FORM Opens a child form and exit the parent form.

CALL_FORM

This procedure opens a child form and immediately switches the application focus to

the child form.

Uses: You can use it when the user clicks a switchboard button or selects a menu item,

and expect to see the child form immediately.

Syntax: CALL_FORM(‘form_specification’, display, switch_menu,

query_mode, parameter_list_id);

Parameter Description

Form_specification Specifies the child form. Always enclosed in single quotation marks. Type the child form name if it is located in the default form folder, or specify the full path and file name, including the drive letter, to the child form’s .fmx file, or you can use the global path variable as following: :GLOBAL.project_path || ‘form_name.fmx’

Display Specifies whether the parent form is hidden by the child form (HIDE) “default value”, or not hidden (NO_HIDE) which is used if you want the two forms to appear side by side on the screen

Switch_menu Specifies whether the child form displays the same pull-down menus as its parent form (NO_REPLACE) “default value”, or displays different menus (DO_REPLACE)

Query_mode Specifies whether the child form runs in normal mode, in which the user can insert, update, or delete values (NO_QUERY_ONLY)”default value”, or in query mode, in which the user can only view data (QUERY_ONLY)

Parameter_list_id Specifies the identifier for an optional parameter list that the parent form can use to pass data values to the child form.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 66

Oracle 10g: Forms Builder I 2012

All of the parameters are optional except for form_specification. If you decide to specify a

value for any of the optional parameters, you must specify values for all of the

preceding optional parameter in the list, without including the values for the

subsequent optional parameters if you’re willing to accept the default value.

OPEN_FORM

This procedure opens a child form and gives the developer the option of not

immediately changing the application focus to the child form.

Uses: Many developers prefer this procedure because it allows the user to multitask

between parent and child forms in the application.

Syntax: OPEN_FORM(‘form specification’, active_mode,

session_mode, parameter_list_id);

Parameter Description

Form_specification Same as in CALL_FORM

Active_mode Specifies whether the application focus switches to the child form (ACTIVATE) “default value”, or is retained by the parent form (NO_ACTIVATE)

Session_mode Specifies whether the child form uses the same database session as the parent form (NO_SESSION) “default value”, or whether the child form starts a new database session (SESSION). In the first case, the DBMS commits all uncommitted values in both forms when a COMMIT command executes. Therefore, the benefit of the second case is that whenever a COMMIT command is issued, transactions are committed only in the form in which the commit command executes, allowing the developer to control how the form commit transactions.

Parameter_list_id Same as in CALL_FORM

All of the parameters are optional except for form_specification. If you decide to specify a

value for any of the optional parameters, you must specify values for all of the

preceding optional parameter in the list, without including the values for the

subsequent optional parameters if you’re willing to accept the default value.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 67

Oracle 10g: Forms Builder I 2012

NEW_FORM

This procedure opens a child form, and immediately exits the parent form.

Uses: use it to allow users to open application forms without going through the main

form switchboard or menus. The advantage: it prevents the user from opening multiple

forms at once, which consumes system memory. But because users should access all

application forms from the main form, it is not recommended to this procedure.

Syntax: NEW_FORM(‘form specification’, rollback_mode,

query_mode, parameter_list_id);

Parameter Description

Form_specification Same as in CALL_FORM

Rollback_mode Specifies whether the DBMS automatically commits records in the parent form and doesn’t roll back any uncommitted transactions (NO_ROLLBACK), rolls back all uncommitted transactions/records to the last save point (TO_SAVEPOINT), or rolls back all uncommitted transactions/records and restore the database to its state at the beginning of the database session (FULL_ROLLBACK).

Query_mode Same as in CALL_FORM

Parameter_list_id Same as in CALL_FORM

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 68

Oracle 10g: Forms Builder I 2012

To create a button with a CALL_FORM procedure (you can try the other two

procedures):

1. To create a button trigger that calls the form LOCATION, select the Button tool

on the tool palette, and draw the button as shown below. Double-click the

button to open its Property Palette, change the button properties as following,

and then close the Property Palette:

Name GO_LOCATION_BUTTON

Label Location

Width 90

Height 16

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 69

Oracle 10g: Forms Builder I 2012

2. To create the button trigger, select the button, right-click, point to

SmartTriggers, and then click WHEN-BUTTON-PRESSED. Type the following

command, compile the trigger, debug it if necessary, and then close the PL/SQL

Editor (this step is similar to step # 14 in how to create a template form).

CALL_FORM(' C:\Documents and Settings\gmazroa\My

Documents\NorthWoodsProject_DONE\LOCATION.fmx');

(The file path is specified as the form is not in the default form folder)

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 70

Oracle 10g: Forms Builder I 2012

3. Save the form, and then Run the form. When the HOME_PAGE form appears,

click Location button. The Location form (LOCATION.fmx) opens.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 71

Oracle 10g: Forms Builder I 2012

Closing forms in an Integrated Database Application

You can close the form by:

Closing the browser window

Using built-in procedures through form command buttons:

Procedure Name Description

CLOSE_FORM Closes the specified form, which might not be the current form

EXIT_FORM Closes the current form, and provides options for committing or rolling back the uncommitted data

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 72

Oracle 10g: Forms Builder I 2012

CLOSE_FORM

This procedure closes a specific form, which might not be the form the user is currently

viewing.

Uses: it allows developers to control the open forms in an application

Syntax: CLOSE_FORM(‘form_specification’);

Parameter Description

Form_specification The form_ID (created by the Form Builder for every open form) or the name of the form module as specified in the Object Navigator

EXIT_FORM

This procedure closes the current form.

Uses: to create a trigger for an Exit button that the user clicks to close a form.

Syntax: EXIT_FORM(commit_mode, rollback_mode);

Parameter Description

Commit_mode Specifies how the DBMS handles umcommited form data. (ASK_COMMIT) “default value” causes the form to ask the user to save uncommitted changes, (DO_COMMIT) automatically commits unsaved data, (NO_COMMIT) automatically discards uncommitted changes.

Rollback_mode Specifies if the DBMS automatically commits or rolls back uncommitted records in the parent form. Same as in NEW_FORM

Both parameters are optional.

To create a button with an EXIT_FORM procedure:

Refer to the steps: 13 - 14 on of creating a template form (you can also try the

CLOSE_FORM procedure).

Creating Triggers to Open/Close Forms

As done previously in all buttons, a trigger is created and tested. You can create triggers

in two different ways; either by right-clicking on the button, or through the Object

Navigator (check steps# of how to create a Log-In Page form).

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 73

Oracle 10g: Forms Builder I 2012

Creating a Log-In Page

Steps to create a Log-In Page form using the template

1. In the Object Navigator, click File on the menu bar, point to New, and then click

Form Using Template. The Open dialog box opens, prompting you to select the

template form. Select the Northwoods_Template.fmb, and then click Open. A

new form appears in the Object Navigator.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 74

Oracle 10g: Forms Builder I 2012

2. Change the form module name to LOGIN_PAGE.

3. Change the Data Block name to LOGIN _BLOCK, Canvas name to LOGIN

_CANVAS, and Window name to LOGIN _WINDOW

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 75

Oracle 10g: Forms Builder I 2012

4. To edit the new form, right-click on LOGIN _PAGE, and then click on Layout

Editor.

5. In the Layout Editor, to create a text item (that will be used by students to enter

their usernames and passwords), select the Text Item tool on the Layout Editor

tool palette, and then draw the text item on the form.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 76

Oracle 10g: Forms Builder I 2012

6. To configure the text item, right-click on the text item, click on Property Pallet,

then modify the following properties:

Name S_ID

Data Type Char

Maximum Length 6

Prompt Student_ID

Visual Attribute Group (optional)

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 77

Oracle 10g: Forms Builder I 2012

7. Then close the Property Palette.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 78

Oracle 10g: Forms Builder I 2012

8. Repeat the previous steps to create a text item for the password with the

following properties:

Name S_PIN

Data Type NUMBER

Maximum Length 4

Prompt Password

Visual Attribute Group (optional)

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 79

Oracle 10g: Forms Builder I 2012

9. To resize the text items, select all of the items as an object group, right-click, and

then click Property Palette. Scroll down to the Physical property node, then

change the Width property value to 80, and the Height property value to 14.

Close the Property Palette. The text items now all appear as the same size.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 80

Oracle 10g: Forms Builder I 2012

10. To reposition the text items, select the first five of the text items only as an

object group, click Layout on the menu bar, and then click Align Components.

Select the Align Left option button to specify the horizontal alignment, select the

Stack option button to specify the vertical alignment, and then click OK.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 81

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 82

Oracle 10g: Forms Builder I 2012

11. To create a Submit button trigger, select the Button tool on the tool palette, and

draw the button as shown below. Double-click the button to open its Property

Palette, change the button properties as following, and then close the Property

Palette:

Name SUBMIT_BUTTON

Label Submit

Width 60

Height 16

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 83

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 84

Oracle 10g: Forms Builder I 2012

12. In the Layout Editor, select the Submit button if it is not already selected. Then

click the Copy button on the tool bar to copy the button, and click the Paste

button to paste the copied button onto the form. Forms Builder pastes the new

button directly on top of the first button. Select the pasted button, and drag it

below the original Submit button.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 85

Oracle 10g: Forms Builder I 2012

13. Select both buttons as an object group, click Layout on the menu bar, and then

select Align Components. Select the Align Left option button to align the buttons

horizontally, and select the Distribute option button to evenly space the buttons

vertically, and then click OK. Position the button group on the form.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 86

Oracle 10g: Forms Builder I 2012

14. Select the second button, open its Property Palette, change its Name property to

CANCEL_BUTTON and its Label property to Cancel, and then close the Property

Palette. Then save the form.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 87

Oracle 10g: Forms Builder I 2012

After the Student has entered his/her username and password, they need to click

Submit button to log in. The Submit button trigger must check entered values against

the S_ID and the S_PIN columns in the STUDENT table. If these values exist in the

Student table, the student is able to log into the system and check other forms.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 88

Oracle 10g: Forms Builder I 2012

First, we need to create a global path variable in the PRE-FORM trigger:

15. In the Object Navigator, open the Triggers node under the LOGIN_PAGE form

module. Select the PRE_FORM node, right-click, and then click PL/SQL Editor.

The PRE_FORM trigger opens in the PL/SQL Editor.

16. To create the global path variable, add the following command as the first

command in the trigger:

:GLOBAL.project_path := 'C:\Documents and

Settings\gmazroa\My Documents\NorthWoodsProject_DONE\';

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 89

Oracle 10g: Forms Builder I 2012

To create the Submit button trigger:

17. To create the button trigger, select the Submit button, right-click, point to

SmartTriggers, and then click WHEN-BUTTON-PRESSED. Type the following

command, compile the trigger, debug it if necessary, then close the PL/SQL

Editor, and save the form. (this step is similar to step # 14 in how to create a

template form).

DECLARE

CURSOR STUDENT_LOGIN_CURSOR IS

SELECT S_ID, S_PIN

FROM STUDENT

WHERE S_ID = :LOGIN_PAGE_BLOCK.S_ID

AND S_PIN = :LOGIN_PAGE_BLOCK.S_PIN;

STUDENT_RAW STUDENT_LOGIN_CURSOR%ROWTYPE;

ATTEMPT NUMBER :=0;

BEGIN

WHILE ATTEMPT < 4 LOOP

OPEN STUDENT_LOGIN_CURSOR;

FETCH STUDENT_LOGIN_CURSOR INTO STUDENT_RAW;

IF STUDENT_LOGIN_CURSOR%FOUND THEN

MESSAGE('Log in Successfully');

CALL_FORM(:GLOBAL.PROJECT_PATH ||

'HOME_PAGE');

ELSE

MESSAGE('Wrong Username and/or Password');

:LOGIN_PAGE_BLOCK.S_ID := '';

:LOGIN_PAGE_BLOCK.S_PIN := '';

GO_ITEM('LOGIN_PAGE_BLOCK.S_ID');

ATTEMPT := ATTEMPT + 1;

END IF;

END LOOP;

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 90

Oracle 10g: Forms Builder I 2012

CALL_FORM(:GLOBAL.PROJECT_PATH || 'EXIT_PAGE');

END; +comments

An alternative way to create a trigger and open the PL/SQL is from the Object

Navigator. Click on Window on the menu bar, and then click Object Navigator. Open

the SUBMIT_BUTTON node, select the Triggers node, and then click the Create

button to create a new trigger. Scroll down the list of events, and double-click

WHEN-BUTTON-PRESSED. The PL/SQL editor opens.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 91

Oracle 10g: Forms Builder I 2012

18. To test the trigger, run the form, choose a Username (S_ID) and a Password

(S_PIN) from the Student table to test, then click Submit. If you enter a correct

combination, an alert message appears, click OK, then the HOME_PAGE form

opens.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 92

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 93

Oracle 10g: Forms Builder I 2012

19. Test the form to see what happens if you enter a faulty combination and see

how an alert message appears, click OK. After exemption the three trials, the

EXIT_PAGE form opens. (The EXIT_PAGE form is created, compiled, and tested

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 94

Oracle 10g: Forms Builder I 2012

before running the LOGIN_PAGE form to create the EXIT_PAGE.fmx file. This form

was created for illustration purposes only)

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 95

Oracle 10g: Forms Builder I 2012

To create the Cancel button trigger:

20. To create the button trigger, select the Cancel button, right-click, point to

SmartTriggers, and then click WHEN-BUTTON-PRESSED. Type the following

command that will clear the text items, compile the trigger, debug it if necessary,

then close the PL/SQL Editor, and save the form.

:LOGIN_PAGE_BLOCK.S_ID := '';

:LOGIN_PAGE_BLOCK.S_PIN := '';

21. To test the trigger, run the form, type any combination for the username and

password, and then click on Cancel. Notice how the fields are cleared now.

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 96

Oracle 10g: Forms Builder I 2012

I S 3 3 3 – I n f o r m a t i o n S y s t e m s D e v e l o p m e n t Page 97

Oracle 10g: Forms Builder I 2012

Problem:

When trying a fault combination of username and password three times, it doesn’t go to

the EXIT_PAGE form. I tried to solve it but couldn’t. I think there is a problem with the

ATTEMPTS variable.

After fixing this problem, we need to:

Add comments to the code

Copy the code and paste it here

Have a new print screen of the new one and paste it here

Have a print screen of the EXIT_PAGE form

Alternative way to create the Cancel button trigger (through Programs Unit node), if

needed


Recommended