Have you ever just needed to know what Oracle APEX page type or page mode you are on? In all of our applications, we use a region on the global page to provide a little useful feedback, context such as who is your current client, or number of days until your password expires. But all too often these nuggets of help clutter small modal dialogue boxes. Annoying?
Let APEX manage it for you!
APEX is rather consistent about having a condition attribute for pages, regions, page items, buttons, etc. While this list is not alphabetized, an order is present. Someone at Oracle decided on a presentation order for us with this idea that the most frequently used condition attributes are at the top:
At present (summer 2016), the list starts:
- Rows Returned
- No Rows Returned
- SQL Expression
What query can I write that tells me if my page is ‘normal’, ‘modal dialog’, or ‘non-modal dialog’. If I can query for normal pages, then I can display my global page region on normal pages and suppress it when it would just be messy clutter on a small dialogue box. The order of the condition attribute list provides a hint: someone at Oracle thinks that the most common type of condition is based on whether a condition exists or does not exist within a query.
Oracle APEX Page Type Query
The folks on the Oracle APEX team have created views for us that allow us to tap into the inner workings of APEX. These are a series of queries I keep in my toolkit.
select page_id, page_name from apex_application_pages where application_id = 122 order by 1, 2 ; select * from apex_application_page_items where application_id = 122 and page_id = 70001 ; select * from apex_application_items where application_id = 122 ; select * from apex_application_page_buttons where application_id = 122 and page_id = 70001 ;
With a quick exploration of the view ‘APEX_APPLICATION_PAGES’, you will find a column ‘PAGE_MODE’ that describes what type of page it is: NORMAL, MODAL DIALOG, etc. With quick effort, you can create a query to find out if the current page, in the current application is normal or not. Please note that this query will be particularly happy outside of APEX as :APP_ID and :APP_PAGE_ID are defined within that context.
select page_id from apex_application_pages where application_id = :APP_ID and page_id = :APP_PAGE_ID and page_mode = 'Normal' ;
Put it together
On page 0, the global page, you can add a region then put a condition on that region that will display only on normal pages as shown in the illustration below: