Create dynamic URL on classic report column in Oracle APEX

Sometimes requirement comes to generate hyperlink dynamically based on column value in classic or interactive reports.

APEX utility apex_page.get_url or apex_util.prepare_url can be used to build hyperlink inside a SQL statement.

select ID,
FIRST_NAME ||' '|| LAST_NAME Name,
       MOBILE_NO,
       DOB,
       ADDRESS,
       CITY,
       PINCODE,
       DISTRICT,
       STATE,
       case
        when username is null then ' <a href=" ' ||APEX_PAGE.GET_URL (p_page => 9993,
p_items => 'P9993_X_EMP_ID',
p_values => ID )|| ' " > Create </a> '
            else  '<a href=" ' ||APEX_PAGE.GET_URL (p_page => 9992 )|| ' " > Update </a>'  
end as Manage_Credentials
from VOLUNTEER

Make sure you set Escape Special Characters = No.

 

The basic syntax is here:

SELECT APEX_PAGE.GET_URL (
            p_page   => 1,
            p_items  => 'P1_X,P1_Y',
            p_values => 'somevalue,othervalue' ) f_url_1,
         APEX_UTIL.PREPARE_URL('f?p=&APP_ID.:1:&APP_SESSION.::::P1_X,P1_Y:somevalue,othervalue')
     FROM DUAL

To pass multiple parameters inside the url , below syntax can be referred.

 

apex_page.get_url( 
p_page => '11',
p_clear_cache => '11',
p_items => 'p11_id,p11_parent_id',
p_values => table.id||','||parent_table.id
) as some_link


You may also like...

2 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *