Search This Blog

Monday, June 23, 2025

How Do I Pass parameters to other page in application

 

How Do I Pass parameters to other page in application

Introduction

In Oracle APEX, creating seamless navigation between pages is essential for building dynamic, user-friendly applications. One powerful feature that enables this is the ability to pass parameters between pages. Whether you're transferring an employee ID to a detail view or preserving filter settings across navigation, parameter passing allows for personalized and context-aware user experiences. In this guide, we’ll walk through how to pass values from one page to another using built-in APEX functionality like buttons, links, and URL syntax, ensuring your applications are both interactive and efficient.


A screenshot of a computer

Description automatically generated


A screen shot of a computer

AI-generated content may be incorrect.


A screenshot of a computer

Description automatically generated

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).

METHOD 1: Using a Button (Redirect with Parameters)

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:
    1. Add a button (e.g., GO_TO_DETAILS).
    2. Set Action = “Redirect to Page in this Application”.
    3. 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

 

METHOD 2: Using a Link in a Report (e.g., IR/IG/Classic)

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.

METHOD 3: Manual URL with Parameters

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.

 

 Important Notes
  •  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.

  1. Report has DEPARTMENT_ID.
  2. Create link/button → target Page 2 → set P2_DEPT_ID = DEPARTMENT_ID.
  3. On Page 2, use:

4.  SELECT * FROM EMPLOYEES WHERE DEPARTMENT_ID = :P2_DEPT_ID



Here  is another example with Images

A screenshot of a computer

AI-generated content may be incorrect.



A screenshot of a computer

Description automatically generated

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

How Do I Make a Faceted Search Map Page in Oracle APEX

Combining faceted search with a map region in Oracle APEX enables users to filter data visually and spatially at the same time. This design ...