Oracle Apex: step by step approach to creating radio buttons in interactive report(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:在交互式报表中创建单选按钮的分步方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Oracle Apex:在交互式报表中创建单选按钮的分步方法
基础教程推荐
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01