How To Store Application Link on Oracle APEX to Create Dynamic Link Menus


This article will discuss about how to store application link on Oracle APEX to create dynamic link menus. When we develop some application usually there will be 2 main areas which are public area and admin area. Public area will show all of prohibit pages/contents on the application to public users. Admin area’s itself will controlling pages/contents that allowed to be viewed by public user. On some application there will found the public area controlling their own pages/contents such as adding a page.



Oracle APEX has a specific format to access its pages from a web browser. The format might be like this:

http://servername:port/apex/f?p=APP_ID:PAGE_ID:APP_SESSION::::params

APP_ID                 = Application ID that we created
PAGE_ID              = Destination page ID will be shown
APP_SESSION    = Session ID from browser session
params                 = parameter that given from user interactions

This article will show you how the public user control its page/content by creating a dynamic menu based on table records. Each of page references will be stored on tables and will be able to be viewed on public area.

First create new desktop application on Oracle APEX then follow the following steps:
1.       Create table named Project
2.       Create Page, Add PL/SQL Dynamic Content Region
BEGIN
HTP.P('<TABLE>');
HTP.P('<TR BGCOLOR="#cccccc"><TH>Project ID</TH><TH>Project NAME</TH></TR>');
                FOR a IN (
                                SELECT
                                                APEX_ITEM.TEXT(1,null,4) ID, APEX_ITEM.TEXT(2) NAME
                                FROM DUAL)
                LOOP
                                FOR i IN 1..5 LOOP
                                                HTP.P('<TR><TD>'||a.ID||'</TD><TD>'||a.NAME||'</TD></TR>');
                                END LOOP;
                END LOOP;
                HTP.p('</TABLE>');
END;

When it executed the appearance will be like this:


3.       Add a button or the region
4.       Create PL/SQL Process, assign to button
DECLARE
                id VARCHAR2(8);
                name VARCHAR2(32);
                par VARCHAR2(128);
    a VARCHAR2(8);
    b VARCHAR2(8);
BEGIN
                FOR i IN 1..apex_application.g_f01.count LOOP
                                id := apex_application.g_f01(i);
                                name := apex_application.g_f02(i);
                                par := 'P3_ID:'||id;
                                IF id IS NOT NULL THEN
INSERT INTO project(projectid,projectname,params) VALUES(id,name,par);
                                END IF;
                END LOOP;
END;
5.       Add TEXT item => P3_ID
6.       Add Report Region
a.       Source
select projectid, htf.anchor('f?p='||:APP_ID||':3:'||:APP_SESSION||'::::'||params,projectname) projectname from project
b.      Report Attributes, edit PROJECTNAME attribute, Display as: Standard Report Column
7.       Run, fill the fields, klik Save


8.       Results


9.       Klik on Projectname Link, if you click One the Id will be filled by 1. This means that if we click on One link it will be open a pege with PAGE_ID=1;
http://servername:port/apex/f?p=APP_ID:PAGE_ID:APP_SESSION::::params
http://servername:port/apex/f?p=APP_ID:1:APP_SESSION::::params


That’s it our discussion about store application link on Oracle APEX. This methods can be applied on dynamic APP_ID or the dynamic parameter passing.

Thank You - Bobsis

No comments

Powered by Blogger.