You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

APEX 5.1:传递IR报表ID至非模态对话框的高效方案问询

Optimizing APEX 5.1 Non-Modal Dialog Navigation with IR Report IDs

Great question! Let's break down the core issue first: the Interactive Report (IR) ID is a client-side value, which is why you can't grab it directly in your SQL query or via apex_util.prepare_url on the server. Your current placeholder-replacement approach works, but repeating it across 70 pages is tedious. Here are three cleaner, scalable solutions to avoid that repetition:

1. Client-Side Attribute Binding with a Reusable JS Function

Instead of using a placeholder and string replacement, attach the IR report ID directly to the link element and fetch it dynamically when the link is clicked. This keeps your server-side URL clean and centralizes the dialog logic:

  • Set the link type to URL.
  • Use apex_util.prepare_url to generate the base URL, leaving the P40_IR_REPORT_ID parameter as a placeholder (e.g., %IR_ID%):
    apex_util.prepare_url(
      'f?p=' || :APP_ID || ':40:' || :APP_SESSION || ':::40:P40_SIGNAL_DEF_ID,P40_IR_REPORT_ID,P40_MODE:' || SIGNAL_DEF_ID || ',%IR_ID%,E',
      p_checksum_type => 'SESSION'
    )
    
  • In the Link Attributes field, add a data attribute to store the IR's static ID reference:
    data-ir-static-id="myStaticID" class="ir-dialog-link"
    

Step 2: Add a Reusable Application-Level JS Function

Add this to your application's Global Page (Page 0) JavaScript section, so it loads on all pages:

$(document).on('click', '.ir-dialog-link', function(e) {
  e.preventDefault();
  const baseUrl = $(this).attr('href');
  const irStaticId = $(this).data('ir-static-id');
  const irReportId = $v(`${irStaticId}_report_id`);
  
  // Replace the placeholder with the actual IR ID
  const finalUrl = baseUrl.replace('%IR_ID%', irReportId);
  
  // Launch the non-modal dialog
  apex.navigation.dialog(finalUrl, {
    title: $(this).data('dialog-title') || 'Record Editor',
    height: 'auto',
    width: '720',
    maxWidth: '960',
    modal: false
  }, 't-Dialog-page--standard', apex.jQuery(`#${irStaticId}`));
});

Now any link with the ir-dialog-link class will automatically handle the IR ID injection—no per-page JS needed.

2. Server-Side IR ID Retrieval (No Client-Side Work Needed)

If you prefer to handle everything on the server, you can fetch the IR's report ID directly from APEX's metadata views. This lets you pass the ID straight through apex_util.prepare_url:

Update your IR's SQL query to include the report ID by joining with apex_application_page_regions:

SELECT
  your_table.*,
  apex_util.prepare_url(
    'f?p=' || :APP_ID || ':40:' || :APP_SESSION || ':::40:P40_SIGNAL_DEF_ID,P40_IR_REPORT_ID,P40_MODE:' || SIGNAL_DEF_ID || ',' || r.report_id || ',E',
    p_checksum_type => 'SESSION'
  ) AS edit_link
FROM
  your_table
CROSS JOIN (
  SELECT report_id
  FROM apex_application_page_regions
  WHERE
    application_id = :APP_ID
    AND page_id = :APP_PAGE_ID
    AND static_id = 'myStaticID' -- Match your IR region's static ID
) r

This pulls the report ID directly from the database, so your generated URL will have the correct value without any client-side manipulation.

3. Build a Reusable APEX Component (For Maximum Scalability)

If you have 70+ pages, creating a reusable component will save even more time:

  • Create a Dynamic Content region template or an APEX plug-in that encapsulates the IR link logic.
  • Configure the component to accept parameters like target page ID, static ID of the IR, and dialog title.
  • Drop this component onto each page instead of recreating the link column from scratch.

This way, if you ever need to adjust the dialog settings or IR ID logic, you only update the component once instead of 70 pages.


内容的提问来源于stack exchange,提问作者Deepthi Prakash

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 09:15:13