Getting Started With Oracle Forms Developer
Getting Started With Oracle Forms Developer
revision 1a
April 25th 2008
Dear Students!
This paper guides you through the installation, configuration, and making first steps with Oracle
Forms Developer. First section show, how to install the Oracle Suite 10g for “invidia”. After this
procedure, I'll show you, how can you built your first form and how can you write new
functionality...
Tamás Fülöp
PS: Please tell me, if you find something wrong (English, or other): fulta+oracle (@) digitus.itk.ppke.hu
thx by fulitomi
Index
Step I. - Setting up Oracle Forms Builder............................................................................................4
Step II. - First Run..............................................................................................................................12
Step III. – Join....................................................................................................................................21
Step IV. – List Of Values, and PL/SQL..............................................................................................24
Step I. - Setting up Oracle Forms Builder
The latest version of Oracle Forms Builder is a part of Oracle Suite 10g, unfortunately you must
download the all installation disks (2 zip files, cc. 800 MB) from Oracle website (after a free
registration, from here: http://www.oracle.com/technology/software/products/ids/index.html).
Please unpack the files, and go to the first disk directory:
Next step, where you can choose the Installation Type. Please select COMPLETE, because this
type of installation contain Oracle Forms Developer.
When the progressbar is 70%, then you should add the second disk location, and click OK button:
The only problem is the login information, you can try connect with your oracle user.
After good login, press next:
Well, we finished.
A “dialog” again...
Click Finish (“Befejezés”) button.
First, we start OC4J Instance, because it's the Forms Application Server for testing.
(Start->Programs->Oracle Developer Suite – DevSuiteHome1 ->Forms Developer->Start OC4J
Instance)
It will be start a background program. Please don't close this window, while you work with Forms
Builder.
Now, you can run Forms Builder ( Start->Programs->Oracle Developer Suite – DevSuiteHome1
->Forms Developer->Forms Builder)
The Object Navigator is an important element, because we can see, and setting all properties of our
4GL program.
Now, we start to write a simple query form, which contain, the CUSTOMER table's all attributes.
First, we need to connect to our database server (File->Connect...).
Type your oracle user name and password. The database name's: “gyak”.
We make a data block, which supply the layout generator (and others) with data. Start the Data
Block Wizard (Tools->Data Block Wizard).
Now, we must to select a table from our database. Please click the “Browse...” button.
This is the Tables window. Select “Customer” in the list of tables (don't worry, if you look some
strange name tables).
Look the selected table and it's available attributes. Click on the double right arrow, because we
want to use all attributes. (Note: usually select the needful attributes eg. join, important data...)
Enter a name of your data block. Please accept now the default name.
Well, we need to create a layout for our data block, so choose “Create the data block, then call the
Layout Wizard”.
This is the Layout Wizard's Welcome. Click Next to proceed.
Now, you can select canvas name and type that you want to use. Click Next to accept the default
values.
Select the items that you would like to show in the form.
You can set some properties of the elements.
You can select a title for the form that you are creating. You can set, how many records displayed on
form, and check if you need scrollbar.
The last window:
With a right click, you can call the properties window, where can set several properties of forms,
and their components.
Now, you can try to run your form (Program->Run Form)
ábra 2: Firefox
ábra 1: IE
MS IE offer a window to download the component, and Mozilla offer a Download Page after click
Install Component. Please download, and start the Installer. After Installing Jinitiator, you must
restart the browser.
You get a screen, like this:
You can download data if you click Execute Query:
The result is this, and you can navigate with blue arrows, and modify data. If you change data, you
need to send and commit it.
Step III. – Join
In this section, we'll tell the customer's loan amount. We will use the following tables:
CUSTOMER(name, street, city)
BORROWER(customer_name, loan_number)
LOAN(loan_number, branch_name, amount)
First we open the Step 2's form, to continue our work. Select “Data Blocks”, in Object Navigator
window. Start the Data Block Wizard, and choose the BORROWER table, and their all attributes,
and press Next.
Next step, we can make the join. Please uncheck the “Auto join”, and press “Create Relationship...”.
Our connection will be based on join connection, so choose that, and press OK.
Choose the Customer table for the join connection (if you have got more data blocks, then there will
be here), and press OK.
Now, you can choose the key attributes from Customer, if you click “Master Item”. Please select
“CUSTOMER_NAME”. You can see the SQL like syntax of join condition. Please press Next.
Well, the last step of Data Block Wizard, you can choose a name for this data block, and make a
Layout for it. If the connection is not 1:1, then I suggest to create more than one row.
After it, you need a Loan data block (and their layout). Make a join with Borrower table, and
generate a layout for it.
We only want to select the amount of loan, so select only it.
If you finished wizards, and run your form, you get similar result:
Step IV. – List Of Values, and PL/SQL
In this step, we make a Button, which open a new window, with the available Branchname, and City
pair, where we can choose the right value pair.
Now, you can create a form like this:
(join: Customer.cname=Borrower.cname and Borrower.lnumber=Loan.lnumber)
Set their properties, with Property Palette. The important properties for us:
– Database Section, Database Item: No
– General Section, Name: BNAME
Please click LOVs on Object Navigator, and start LOV Wizard (Tools->LOV Wizard)
(Note: Try to use the funny SQL builder, where you can clickclickclick a new query. :) )
We need all Columns, so select their.
Please click on Branch_name's return value, and press “Look up return item...”. Now you can
assign the BNAME for Branch_name.
Select for BRANCH_CITY: CUSTOMER.BNAME (this is our new display item...). After it, press
Next.
Now you can add a title name for LOV, after it, press Next.
Retrieve 20 items, or more...
You need to create a new button, for update. Set their name with Property Palette: BRANCH_BUT
Now we write a function for this button. Select the button, click with right mouse button, and select
the PL/SQL Editor. It will be open a list of triggers. Select “WHEN-BUTTON-PRESSED”.
Now get a PL/SQL editor, where you can write the button press trigger. We want to show our LOV.
Please copy this simple PL/SQL code:
You can test the code, if you press the Compile button (blue arrow). Close the Window, and now,
you can run your form, with new functionality.