我使用以下查询具有以下表格报告:
select id,
name,
telephone,
apex_item.checkbox2(1,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
Run Code Online (Sandbox Code Playgroud)
此报告显示10条记录,其中驱动键是分配给F01的复选框.
我的问题是,这是一个表格报告,使用Oracle APEX_APPLICATION.G_F01.COUNT - 如何访问textarea字段的值,其中"my_comment"是报表上的用户可输入值,而不是数据库列/表?
从我所看到的,它似乎是一个序列问题,如果你输入的记录不正确的顺序,那么值将被遗漏.
我只勾选第1,3和5行的复选框,因此希望返回仅与这些选定行相关的textarea字段的值.
这令我感到困惑.
谢谢.
是的,当表格形式包含复选框时,它会变得棘手.在您的示例中,g_f01将只包含3个值为1,3,5的元素,但是数组g_f30将包含10个元素.
通常在使用apex_item构建表格形式时,最好也使用APEX集合:
apex_item.checkbox2(1,seq_id)因此,在您的示例中,您可以首先更新APEX集合,以通过将c050设置为"Y"来指示已勾选的行:
for i in 1..apex_application.g_f01.count loop
apex_collection.update_member_attribute('MYCOLL', apex_application.g_f01(i),
50, 'Y');
end loop;
Run Code Online (Sandbox Code Playgroud)
然后使用其他更改更新它:
for i in 1..apex_application.g_f02.count loop
apex_collection.update_member_attribute('MYCOLL', apex_application.g_f02(i),
20, apex_application.g_f20(i));
apex_collection.update_member_attribute('MYCOLL', apex_application.g_f02(i),
30, apex_application.g_f30(i));
end loop;
Run Code Online (Sandbox Code Playgroud)
最后将相关更改应用于my_table:
for r in (select c002, c020, c030
from apex_collection
where collection_name = 'MYCOLL'
and c001 = 'Y' -- Checked rows only
)
loop
update my_table
set my_date = r.c020
, my_comment = r.c030
where id = r.c002;
end loop;
Run Code Online (Sandbox Code Playgroud)
就那么简单...?!
| 归档时间: |
|
| 查看次数: |
8999 次 |
| 最近记录: |