Oracle Apex:在交互式报告中创建单选按钮的分步方法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28601892/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:44:37  来源:igfitidea点击:

Oracle Apex: step by step approach to creating radio buttons in interactive report

oracleradio-buttonoracle-apex

提问by tinlin28

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 Reporthelped me in creating forms and I'm looking for a similar one.

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

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?

Any advice is much appreciated.

非常感谢任何建议。

Thanks

谢谢

回答by Tony Andrews

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

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

Method 1: radio button

方法一:单选按钮

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

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

Report SQL statement

报告SQL语句

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

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

Report

报告

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

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

Changing column type

更改列类型

Now we see:

现在我们看到:

Report after fix

修复后报告

Clicking on the radio button on any row selects it and de-selects 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:

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

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

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_f01which we chose by passing 1as the first parameter to apex_item.radiogroup:

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

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

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

enter image description here

在此处输入图片说明

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

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

Method 2: column link

方法二:栏目链接

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

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

enter image description here

在此处输入图片说明

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

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

enter image description here

在此处输入图片说明

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

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

回答by Manfred

For Apex 5 you have to change "Escape special characters" to "No" instead of changing the column property to "Standard Report Column":

对于 Apex 5,您必须将“转义特殊字符”更改为“否”,而不是将列属性更改为“标准报告列”:

enter image description here

在此处输入图片说明