How Do I Pass parameters to other page in application
Introduction
Objective:
Pass values (parameters) from one page (source) to another page (target)
in your APEX application, enabling context-aware navigation (e.g., from a
report to a detail view, or from a dashboard to a filtered form).
Step-by-Step:
Step 1: Ensure Page Items Exist
- On Page A (source), ensure
the item holding the value exists (e.g., P1_DEPT_ID).
- On Page B (target), create
a matching page item (e.g., P2_DEPT_ID) to receive the value.
ep 2: Create a Button
- Page Designer for Page A:
- Add a button (e.g., GO_TO_DETAILS).
- Set Action = “Redirect to
Page in this Application”.
- Set Target Page = e.g., 2 (Page B).
Step 3: Set Parameters
- Scroll to Set Items.
- Add a row:
- Name: P2_DEPT_ID
- Value: &P1_DEPT_ID. (or select P1_DEPT_ID from dropdown)
This maps P1_DEPT_ID from Page A to P2_DEPT_ID on Page B.
Step 4: Use on Target Page
- On Page B, reference :P2_DEPT_ID in SQL reports, forms, or PL/SQL
code.
·
SELECT * FROM DEPARTMENTS WHERE DEPARTMENT_ID = :P2_DEPT_ID
Step-by-Step:
Step 1: Create Link Column
- In an Interactive Report or
Classic Report:
- Go to Column Attributes.
- Click Link.
- Set Link Target:
- Page: 2
- Set Items:
- Name: P2_EMP_ID
- Value: #EMPLOYEE_ID# (substitute
column name)
Step 2: Create Matching Item on Target Page
- On Page B, ensure P2_EMP_ID exists.
Step 3: Use Parameter
- Use :P2_EMP_ID in target page regions or logic.
This is useful for PL/SQL-generated links, dynamic actions, or navigation
menus.
URL Format:
f?p=&APP_ID.:2:&SESSION.::NO::P2_DEPT_ID:&P1_DEPT_ID.
Breakdown:
- &APP_ID. – current application
- 2 – target page
- &SESSION. – session
- P2_DEPT_ID – receiving item
- &P1_DEPT_ID. – source value
Use this format in dynamic PL/SQL blocks or links.
- Always ensure "Maintain Session
State" is enabled for the target item.
- Avoid passing sensitive data unless
encrypted.
- Use Before Header processes on the
target page to act on parameters early.
Real-Life Example
You have a report on Page 1 listing departments. You want users to click
a button or link and go to Page 2 to see employees in that department.
- Report has DEPARTMENT_ID.
- Create link/button → target Page
2 → set P2_DEPT_ID = DEPARTMENT_ID.
- On Page 2, use:
4. SELECT * FROM EMPLOYEES WHERE
DEPARTMENT_ID = :P2_DEPT_ID
Here is another example with Images
Conclusion
Passing parameters between pages in Oracle APEX unlocks a wide range of possibilities, from maintaining user context to driving targeted reports and forms. By leveraging built-in tools like button actions, URL parameters, and item value mappings, developers can create intuitive workflows without writing extensive custom code. Mastering this technique is a key step toward building robust and interactive APEX applications that respond intelligently to user actions.
No comments:
Post a Comment