Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Please ask technical questions in the appropriate category. Thank you!

Dynamic Navigation Menu - is_current

RyanSFO-OracleMay 18 2023 — edited May 18 2023

I'm struggling to determine the current page with a dynamic navigation menu when I have the same page in the navigation menu multiple times, with different parameters. My SQL for the navigation menu looks something like this:

select
    list_level
    , label
    , target
    , case when :APP_PAGE_ID = page_number then 'YES' else 'NO' end as is_current
    , image
    , subsort

from (
select * from (
    select     
            1 list_level
            , 'Home' label
            , 1 page_number
            , 'f?p='||:APP_ID||':1:'||:APP_SESSION||'::'||:DEBUG||'::::' target
            , 'fa-home' image
            , 0 priv_level
            , 1 subsort
            , '0' p_category
        from dual
    UNION all
        select * from (
            select * from (
                select 
                    2 list_level
                    , p.name label
                    , 10 page_number
                    , 'f?p='||:APP_ID||':10:'||:APP_SESSION||'::'||:DEBUG||'::PERSONID:'|| p.personid || ':' target
                    , 'fa' image
                    , 0 priv_level
                    , 3 subsort
                    , c.display p_category
                from person p
                inner join category c on c.categoryid = p.categoryid
                union all
                select     
                    1 list_level
                    , c.display label
                    , null page_number
                    , null target
                    , c.image image
                    , 0 priv_level
                    , 2 subsort
                    , c.display p_category
                from category c
                order by p_category, list_level, label
            )
        )
)
order by p_category, list_level
)

The SQL outputs a nice list like this when I run it in SQL Developer:

1	Home            f?p=:1:::::::               NO  fa-home	1
1	Admins                                      NO  fa-lock	2
2	Joe             f?p=:10:::::PERSONID:1:     NO  fa-user	3
2	July            f?p=:10:::::PERSONID:2:     NO  fa-user	3
2	Jim             f?p=:10:::::PERSONID:3:     NO  fa-user	3
1	Contributors                                NO  fa-lock	2
2	Jennifer        f?p=:10:::::PERSONID:4:     NO  fa-user	3
1	Base Users                                  NO  fa-lock	2
2	John            f?p=:10:::::PERSONID:5:     NO  fa-user	3

This renders well as my dynamic menu, but all of the page_ids are 10, so my logic to identify the current page obviously doesn't work. I was looking for a way to access the parameters but couldn't see a straightforward way. APP_REQUEST_DATA_HASH looks like it would be helpful, but how can I compare the item name/ item values with the hashed value? Am I going down the wrong approach? Thanks!

This post has been answered by Gabriel Guzman on May 18 2023
Jump to Answer
Comments
Post Details
Added on May 18 2023
2 comments
569 views