Oracle APEX vs. Oracle Forms challenge: create a master-detail report
Recently, I had an opportunity to create several new application features in Oracle APEX and Oracle Forms. I found myself intrigued by the differences and similarities in their approaches. This sparked the idea to share my insights through this blog.
That's why I created a simple Departments-Employees master-detail report using APEX and Oracle Forms. I wanted to do it as much automatically as possible, using default settings.
Rather than advocating for one tool over the other, I aim to show you a step-by-step guide to create this report using both tools.
No judging, just a tutorial and a lot of screenshots.
Share your thoughts in the comments if you want.
Enjoy reading!
Initial setup
Oracle database with tables: "DEPARTMENTS" and "EMPLOYEES" with FOREIGN KEY relation by column DEPARTMENT_ID + inserted some sample rows.
Oracle Forms 12.2
Oracle APEX 23.2
Oracle Forms
Create a new form
- Open Oracle Form Builder and create a new Form Module by choosing "File -> New -> Form"
Result is:
Create DEPARTMENTS data block
- Create a new data block by choosing "Data Blocks" and green "plus" button
Pick "use the Data Block Wizard" and press OK
The Wizard screen will show up
Select the type of data block to create.
- Choose the parent table and columns you want to include in the data block
- Give a name to your data block
Create DEPARTMENTS layout
Create a data block and call Layout Wizard
Select a canvas type to put the data block on. I chose default "content" (sounds a little bit like APEX's Static Content region isn't it ?:) )
Choose the data block columns you want to be included in your canvas frame
- Choose prompt (label), width and height of your columns
- Select layout style "tabular"
- Choose the frame title, the number of records to be displayed, the distance between records and the optional scrollbar
- The first data block for the master table Departments is created. This is a preview of what I created (but it's like a preview of what I did similar to what you see in APEX Builder)
Create EMPLOYEES data block (detail report)
- Choose the data block wizard again, and pick "table and view"
- Choose the existing EMPLOYEES table and all columns to be included in the data block
Create a relationship to the parent DEPARTMENTS table. Forms are smart and have an "auto-join data block" option
Table DEPARTMENTS was automatically selected, but I had to choose what columns are used to join both tables - DEPARTMENT_ID
Give a name to a new data block and call Layout Wizard again
Create EMPLOYEES layout
Select a canvas to put the data block on. I will pick CANVAS4 (automatically created for DEPARTMENTS earlier)
Choose data block items to be shown on the canvas
Pick a label, width and height
Select "tabular" layout style
Name a frame, set the number of records, distance and scrollbar
That is the final result (a developer view)
And a final view that the end user will see
Oracle APEX
Ok, now I will do exactly the same master-detail data block using APEX 23.2
Create a new master detail page
Open APEX Builder and click "Create page"
Choose master-detail, default "Stacked"
Pick "master" table DEPARTMENTS
The primary key column DEAPRTMENT_ID is picked automatically
Select detail table EMPLOYEES
Pick a master-detail relationship from a list of values and click "Create Page"
Your master-detail page is ready
Summary
As I promised, no judging :)
Feel free to share your thoughts in the comments.
Rafal
Subscribe to my newsletter
Read articles from Rafal Grzegorczyk directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Rafal Grzegorczyk
Rafal Grzegorczyk
Oracle APEX & PL/SQL Developer with 10 years of experience in IT, including financial systems for government administration, energy, banking and logistics industry. Enthusiast of database automation. Oracle ACE Associate. Certified Liquibase database versioning tool fan. Speaker at Kscope, APEX World, SOUG, HrOUG, POUG and DOAG. Likes swimming in icy cold lakes in winter and playing basketball.