了解Oracle Apex_Application.G_Fnn及其使用方法 [英] Understanding Oracle Apex_Application.G_Fnn and how to use it
问题描述
我对Oracle apex_application.gfnn的工作方式以及它仅适用于Oracle ApEx中的标准SQL报表还是仅适用于SQL(可更新报表,即表格形式)感到困惑.
I am quite confused with how Oracle apex_application.gfnn works and whether it only works for standard SQL reports in Oracle ApEx or only with SQL (Updateable reports, i.e. tabular forms).
基本上,我正在尝试使用此示例SQL(仅是标准SQL报告)实现以下目标,但是我不确定这种类型或报告是否可以实现我想要实现的目标,即:
Basically I am trying to achieve the following using this sample SQL, which is just a Standard SQL Report but I'm unsure if what I am trying to achieve is possible with this type or report, i.e.:
select id,
name,
telephone,
apex_item.checkbox2(10,id) as "Tick when Contacted",
apex_item.text(20,my_date) as "Date Contacted",
apex_item.textarea(30,my_comment,5,80) as "Comment"
from my_table
基于上述SQL,假定此SQL查询返回10行.现在使用复选框作为我的驾驶ID,我在所有奇数记录/行(即第1、3、5、7、9行)的复选框中打勾,并且对于这些行中的每行,我还输入日期值(f20)和注释(f30)
Based on the above SQL, assume this SQL query returns 10 rows. Now using checkbox as my driving id, I tick the checkbox of all odd records/rows, i.e. rows 1,3,5,7,9 and for each of these rows, I also enter a date value (f20) together with a comment (f30)
牢记这一点,然后我想创建一个页面处理,当用户按下保存"按钮时将调用该页面处理,该处理将遍历这些选中的行并存储每个记录,我的日期和我的评论,但仅用于我选择的行.
Keeping this in mind, I then want to created a page process that is called when the user presses the "Save" button that will iterate through these checked rows and store for each record, my date and my comment but only for the rows that I have selected.
因此,根据以上所述,我希望表中具有5条以下各列的新闻行:
So based on the above, I would expect to have 5 news rows in my table with the following columns:
ID MY_DATE MY_COMMENT
1 26/08/2012 Comment A
3 27/08/2012 Comment B
5 28/08/2012 Comment C
7 29/08/2012 Comment D
9 30/08/2012 Comment E
不幸的是,我不确定如何使用apex_application.G_F10.COUNT
实现这一目标.
Unfortunately I am unsure how to achieve this using apex_application.G_F10.COUNT
.
我希望能够为我勾选了复选框的每一行访问这些数组元素(f20)和f(f30)的内容.
I want to be able to access the content of each of these array elements (f20) and f(f30) for each row that I have ticked the checkbox with.
这是可能的还是我误解了apex_application.G_Fnn的工作方式?如果这不可能,我该如何实现呢?我需要表格报告吗?
Is this possible or have I misunderstood how apex_application.G_Fnn works? If this is not possible, how I can achieve this? Do I need a tabular report?
推荐答案
您非常亲密.
select apex_item.checkbox2(10, empno) select_me,
apex_item.text(20, empno) empno,
apex_item.text(30, ename)||apex_item.hidden(50, empno) ename
from emp
我要合并隐藏的项目,因为我不想在其自己的列中使用它.会场布局.
另外,由于复选框的工作方式,因此存在隐藏项.复选框仅提交其选中项目的值.这将意味着数组10具有3个值.其他数组仍将包含所有行的值.
这就是为什么我再次添加隐藏的empno的原因:这样我们就可以将检查后的值与其他行进行匹配.
I'm concatenating the hidden item since i don't want it in its own column. Messes with the layout.
Also, the hidden item is there because of how checkboxes work. Checkboxes only submit their values for checked items. This would mean that array 10 has 3 values. The other arrays would still contain the values for all rows.
This is why i added the hidden empno again: so we can match the checked values to the other rows.
提交过程中:
DECLARE
v_empno emp.empno%TYPE;
v_ename emp.ename%TYPE;
BEGIN
--f10: checkbox
--f20: empno
--f30: ename
--f50: empno again
for i in 1..apex_application.g_f10.count
loop
for j in 1..apex_application.g_f50.count loop
if apex_application.g_f10(i) = apex_application.g_f50(j)
then
-- access values for the selected rows in the other arrays
v_empno := apex_application.g_f20(j);
v_ename := apex_application.g_f30(j);
apex_debug_message.log_message('Employee: '||v_empno||' - '||v_ename);
end if;
end loop;
end loop;
END;
运行页面,启用调试,选择记录2、4和6,然后提交.
Run page, enable debug, select records 2, 4 and 6, submit.
调试输出:
您现在要做的就是将处理放入该循环中.
All you now need to do is put your processing in that loop.
这篇关于了解Oracle Apex_Application.G_Fnn及其使用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!