Understanding Oracle Apex_Application.G_Fnn and how to use it

大城市里の小女人 提交于 2019-12-03 14:14:19

You're very close.

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

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.

On submit process:

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;

Run page, enable debug, select records 2, 4 and 6, submit.

Debug output:

All you now need to do is put your processing in that loop.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!