Oracle Apex - Add Interactive Grid into a Form

In this Oracle Apex tutorial, I will teach you how to add an Interactive Grid into a Form manually to make it behave like master-detail form.

I have an existing form on the Department table which is having two fields, DEPTNO and DNAME. The requirement is to add a detail section below the form to show all employees under the current department, and the user can add/edit employees under that department.

So, in this case, we should add an Interactive Grid into the form. Follow these steps:

Add an Interactive Grid into a Form Manually in Oracle Apex

  1. Open the form in Oracle Apex designer in which you want to add an Interactive grid. To demonstrate this, I am using the Department form, which is being called by the Department Report.
  2. Then right-click on the Content Body and click on the Create Region and set the following properties highlighted in the image below:

Interactive Grid Report setting step - 1

  1. I added the following query into the above SQL Query section:
Select ROWID, empno as employee_no, ename as employee_name, hiredate, deptno as dept, sal as salary from emp where deptno = :p5_deptno

You can see above that I added the P5_DEPTNO in the Page Items to Submit because I am using this item in the query. So you should add all the items you are using in the query to Page Items to Submit.

  1. It is better to use ROWID as Primary Key instead of actual Primary Keys for the Forms and Reports in Oracle Apex because it is faster to fetch and update records using the ROWID for faster performance, also helps to assign default values to the columns we are linking to the master table. In this example, we are linking DEPTNO from the EMP table to the DEPT table. So now click on the DEPT field in the Employees region and set the following properties:

DEPT column settings

The above properties I have set because when the user clicks on the Add Row button in the Interactive GRID, it will take the default DEPTNO from the Master table DEPT.

  1. Now click on the Attribute section of this Interactive Grid and set the properties shown below:

Interactive Grid setting step - 5

Now when you open the Department form from the Department Report for a specific department number, you will have the following output:

Oracle Apex Form with Interactive Grid Example.

See also:

Written by Vinish Kapoor

An Oracle Apex Consultant, Oracle ACE, and founder of and a question and answer forum for developers.


Newest Most Voted
Inline Feedbacks
View all comments