Related Tables

This blog will give an overview of a recent experience with creating a Master Detail page in Oracle APEX.  For a new application, I had to create a form that could manage data for two related tables.

APEX is able to create an application from a basic table with an interactive form and report.  The problem was that if I had two related tables, it would be cumbersome to create or view the data on separate pages.

Doing This Manually

I added an Interactive Grid to the bottom of a form page.  From there, I created a page process for the Interactive Grid to relate to the form items.

By using it on the same page as a form, I created a visualization of the many-to-one relationship that I had in the table structure. After customizing it to work within the form page, it worked exactly as I envisioned in my head.

What Do You Mean, It Already Exists?!?!

After all that work, it was brought to my attention that APEX comes with this feature built-in!

In my previous blog post (https://www.traust.com/apex-beginners-guide-build-a-quick-app), I showed how to quickly build an application in APEX.  Specifically, an application for creating and relating a table of people and a table of things.  I will reference those tables for the example below.

There is Fast…and then there is APEX Fast

As I found out, APEX has another big time-saving feature called the master detail page.

When we create new pages in APEX, we are given choices of the type of page we want to make (report, form, chart, wizard, etc…).  For this exercise, we want to create a new master detail page.  This will allow us to attach multiple ‘things’ to each individual ‘person’ in our database.

In the Application Builder, create a new page and then select the MASTER DETAIL option, and then DRILL DOWN.  Follow the wizard so that APEX knows how the Master and Detail tables relate to each other.

Wrapping Up

We now have a page that shows all the ‘Things’ each ‘Person’ has assigned to them.  This also allows us to assign more of the ‘Things’ we have created to a ‘Person.’

 

References

Learn More

Disclaimer:
We do not take responsibility for any unintended or unwanted consequences in your instance of Oracle, Oracle APEX, or related products as a result of reading our blogs or following our guides. Though the information is fully tested and generally safe to use, our lawyers really have a thing against admitting potential wrongdoing.