Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Dynamic breadcrumb

mtDec 17 2024

Using Apex 24.1.3

I have been trying to get a dynamic breadcrumb for a long time.
Between me and ChatGPT, I think I am DONE!
Sharing this for any concerns, feedback, or if it helps anyone else.

The table structure for TREE_MENU
node_id = pk
parent_id = fk to create hierarchy
menu_desc = the label
seq - numeric, for sequencing
Page_no

the query began life as this, to get the path:

select 
'Home > '||
LTRIM(substr(sys_connect_by_path (menu_desc,' > '),0),' > ') path
from tree_menu
where node_id = :P0_NODE_ID
and connect_by_root (parent_id) is null
connect by prior node_id = parent_id

I asked ChatGPT for help, turning it into clickable nodes, and we have this:

SELECT
   -- Make Home clickable using GET_URL (assuming home page is page 1)
   '<a href="'|| APEX_PAGE.GET_URL(p_page => 1) ||'">Home</a> > ' ||
   SUBSTR(
     SYS_CONNECT_BY_PATH(
       '<a href="'||
       APEX_PAGE.GET_URL(
         p_page   => page_no,
         p_items  => 'P0_NODE_ID',
         p_values => node_id
       ) || '">' || menu_desc || '</a>',
       ' > '
     ), 4
   ) AS path
FROM tree_menu
WHERE node_id = :P0_NODE_ID
AND CONNECT_BY_ROOT (parent_id) IS NULL
CONNECT BY PRIOR node_id = parent_id;

This query is in a BREADCRUMB region on Page_0, as a classic report, stretched, with no row shading or borders. I'd like the font to be bigger, but that will have to wait for another day

mt in NY

Comments
Post Details
Added on Dec 17 2024
8 comments
189 views