如何使用APEX_APPLICATION.G_F01访问APEX_ITEM.TEXTAREA字段 [英] How to Access APEX_ITEM.TEXTAREA Field Using APEX_APPLICATION.G_F01
问题描述
我使用以下查询获得以下表格报告:
I have the following tabular report using the following query:
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
此报告显示10条记录,其中驱动键是分配给F01的复选框.
This report displays 10 records where the driving key is the checkbox assigned to F01.
我的问题是,因为这是一个表格报表,所以使用Oracle APEX_APPLICATION.G_F01.COUNT-我如何访问textarea字段的值,其中"my_comment"是报表中用户可输入的值,而不是数据库中的值列/表?
My problem is, as this is a tabular report, using Oracle APEX_APPLICATION.G_F01.COUNT - how can I access the values of the textarea field, where "my_comment" is a user enterable value on the report and not from a database column/table?
据我所见,这似乎是一个序列问题,如果您输入的记录顺序不正确,则会丢失值.
From what I can see, it seems to be a sequence issue and if the records you enter are not in the correct order then values are missed.
我只勾选第1、3和5行的复选框,因此希望返回仅与这些选定行相关的textarea字段的值.
I am only ticking the checkbox for row 1, 3 and 5 and so expect to return the values for textarea fields that relate to these selected rows only.
推荐答案
是的,当表格形式包含复选框时,它会变得很棘手.在您的示例中,g_f01将仅包含3个元素,其值分别为1、3、5,而数组g_f30将包含10个元素.
Yes, it gets tricky when your tabular form contains checkboxes. In your example, g_f01 will only contain 3 elements with values 1, 3, 5 but array g_f30 will contain 10 elements.
通常在使用apex_item构建表格形式时,最好也使用APEX集合:
usually when using apex_item to build tabular forms it is best to also use an APEX collection:
- 使用my_table中的相关数据在进入页面时填充APEX集合.将mytable行的ID保留在隐藏的项目中,例如apex_item.hidden(2,id).
- 在复选框项
apex_item.checkbox2(1,seq_id)
中,将报告写成从集合而不是my_table开始工作,并使用seq_id而不是ID.
- 提交后,使用g_fxx数组更新收藏集-经常使用一次以上的通行证.
- 最后使用集合更新my_tabl
- Populate the APEX collection on entry to the page with the relevant data from my_table. Hold the ID of the mytable rows in a hidden item e.g. apex_item.hidden(2,id).
- Write the report to work from the collection rather than my_table, and to use seq_id rather than ID in the checkbox item:
apex_item.checkbox2(1,seq_id)
- On submit, use the g_fxx arrays to update the collection - oftne using more than one pass.
- Finally use the collection to update my_tabl
因此,在您的示例中,您可能会首先通过将c050设置为"Y"来更新APEX集合,以指示哪些行已被勾选:
So in your example you might first update the APEX collection with to indicate which rows have been ticked by setting c050 to '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;
然后使用其他更改对其进行更新:
Then update it with the other changes:
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;
最后将相关更改应用于my_table:
Finally apply the relevant changes to 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;
就这么简单...?!
这篇关于如何使用APEX_APPLICATION.G_F01访问APEX_ITEM.TEXTAREA字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!