如何从下拉选择框中引用值...?

发布于 2024-12-08 09:55:19 字数 464 浏览 2 评论 0原文

我正在使用 Oracle APEX 并且正在生成交互式报告..现在我有一个下拉选择框,其中包含值列表 (LOV)..我想要做的是使用下拉列表中当前选择的值用于生成交互式报告的 SQL 查询中的下拉框。例如,这是用于生成交互式报告的 SQL 查询,仅显示具有销售员级别的员工:

 select "EMP"."EMPNO" as "EMPNO",
        "EMP"."ENAME" as "ENAME",
        "EMP"."RANK" as "RANK",
 from   "EMP" "EMP" 
 where  "EMP"."RANK"  = 'SALESMAN'

上面的查询完全适合我...现在我有一个APEX 中同一页面上的下拉框是名为 RANKS,并且具有以下 LOV:销售员、职员、会计、部门主管

如何更改 SQL 查询,以便它现在在等级下拉列表中查找当前选定的等级,然后仅显示具有该等级的员工...

I'm using Oracle APEX and I'm generating an interactive report .. Now I have a drop down selection box which has a list of values (LOVs) .. What I want to do is to use the currently selected value in the drop down box in the SQL query being used to generate the interactive report .. Like for example this is the SQL query for generating the interactive report to only show employees with rank Salesman:

 select "EMP"."EMPNO" as "EMPNO",
        "EMP"."ENAME" as "ENAME",
        "EMP"."RANK" as "RANK",
 from   "EMP" "EMP" 
 where  "EMP"."RANK"  = 'SALESMAN'

The above query completely works for me ... Now I have a drop down box on the same page in APEX which is named RANKS, and has this LOV: SALESMAN, CLERK, ACCOUNTANT, DEPTHEAD

How do I change the SQL Query so that it now looks up the currently selected rank in the ranks drop down list and then only displays employees with that rank ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抹茶夏天i‖ 2024-12-15 09:55:19

例如,如果您的等级 LOV 称为 P1_RANKS,则您可以将查询 SQL 更改为:

select empno, ename, rank
from emp
where rank = :P1_RANKS

但是,只有在选择等级后才有效。如果要在未选择级别时显示所有员工,请执行以下操作:

select empno, ename, rank
from emp
where (:P1_RANKS is null or rank = :P1_RANKS)

您可以使选择列表提交页面以刷新报表,或者最好创建动态操作以在选择列表项更改时刷新报表。

If your ranks LOV is called P1_RANKS for example, then you can change the query SQL to:

select empno, ename, rank
from emp
where rank = :P1_RANKS

However, that only works once a rank has been selected. If you want to show all employees when no rank has been selected do this:

select empno, ename, rank
from emp
where (:P1_RANKS is null or rank = :P1_RANKS)

You can either make the select list submit the page to refresh the report or, preferably, create a dynamic action to refresh the report when the select list item is changed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文