Oracle Apex:在交互式报告中创建单选按钮的分步方法 [英] Oracle Apex: step by step approach to creating radio buttons in interactive report

查看:53
本文介绍了Oracle Apex:在交互式报告中创建单选按钮的分步方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个很好的视觉教程来介绍如何在 Apex 4.2 中创建单选按钮的各个步骤?本教程 在 APEX 中创建表单以在交互式报表的查询中设置变量 帮助我创建了表单,我正在寻找类似的表单.

Is there a good visual tutorial that takes through the various steps on how to create radio buttons in Apex 4.2? This tutorial Creating a Form in APEX to set Variables in a Query for an Interactive Report helped me in creating forms and I’m looking for a similar one.

Within my application, I would like to add a radio button to each row of my interactive report which when selected would take the user to another report combining different tables?

Within my application, I would like to add a radio button to each row of my interactive report which when selected would take the user to another report combining different tables?

非常感谢任何建议.

谢谢

推荐答案

您可以使用列链接来选择记录并导航到另一个页面,或者使用单选按钮和页面按钮/链接来执行此操作.我将使用一个关于 DEPT 表的简单报告来演示这两种方法.

You could either use a column link to select the record and navigate to another page, or a radio button and a page button/link to do it. I'll demonstrate both using a simple report on the DEPT table.

方法一:单选按钮

对于单选按钮,我们可以使用 apex_item.radiogroup 函数在报告中添加一个附加列,以创建一个值为 DEPTNO 的单选按钮:

For the radio button we can add an additional column to the report using the apex_item.radiogroup function to create a radio button whose value is the DEPTNO:

默认情况下,出于安全原因,radiogroup 的 HTML 将被转义,这不是您想要的,但很好地说明了它的作用:

By default, the HTML of the radiogroup will be escaped for security reasons, which is not what you want but illustrates what it is doing quite nicely:

我们可以通过将列属性更改为标准报告列"来解决此问题:

We can fix that by changing the column property to "Standard Report Column":

现在我们看到:

单击任何行上的单选按钮选择它并取消选择其他行上的按钮.

Clicking on the radio button on any row selects it and deselects the buttons on other rows.

要导航到包含选定行的另一个页面,我们需要一个按钮来提交具有特殊请求的页面:

To navigate to another page with the selected row we need a button to submit the page with a special request:

点击后,该按钮将提交请求值为SELECT"的页面;(我选择的按钮名称).因此,我们可以编写一个提交时页面进程以在请求为SELECT"时触发,找出已选择哪个单选按钮(如果有)并将所选 DEPTNO 保存到名为 P34_DEPTNO 的隐藏项中.我们通过将 1 作为第一个参数传递给 apex_item.radiogroup 来查看我们选择的 APEX 数组 apex_application.g_f01 来找出哪个按钮:

When clicked, that button will submit the page with a Request value of "SELECT" (the button name I chose). So we can write an on-submit page process to fire when the request is "SELECT", find out which radio button has been selected (if any) and save the selected DEPTNO to a hidden item called say P34_DEPTNO. We find out which button by looking at the APEX array apex_application.g_f01 which we chose by passing 1 as the first parameter to apex_item.radiogroup:

if apex_application.g_f01.count > 0 then
   -- Array has been populated i.e. user chose a value
   :p34_deptno := apex_application.g_f01(1);
else 
   -- Array has not been populated i.e. user did not choose a value
   :p34_deptno := null;
end if;

然后我们可以定义一个导航到新页面的分支,如果 (a) request = 'SELECT' 并且 (b) P34_DEPTNO 不为空.

Then we can define a branch that navigates to the new page if (a) request = 'SELECT' and (b) P34_DEPTNO is not null.

就是这样.相当多的工作,但如果这是需要的话.

And that's it. Quite a lot of work, but if that's the requirement that will do it.

方法二:列链接

更简单的方法是取消单选按钮,只需将报告列之一变成链接:

The simpler way is to dispense with the radio buttons and just make one of the report columns into a link:

这会将列(我选择 DNAME)变成一个链接,该链接导航到带有所选 DEPTNO 值的新页面:

This turns the column (I chose DNAME) into a link that navigates to the new page taking the selected DEPTNO value with it:

就是这样!无隐藏项,无按钮,无页面进程,无分支...

That's it! No hidden item, no button, no page process, no branch...

这篇关于Oracle Apex:在交互式报告中创建单选按钮的分步方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆