1. 程式人生 > >Oracle Apex 有用筆記系列 6 - 可編輯交互報告 Editable Interactive Report

Oracle Apex 有用筆記系列 6 - 可編輯交互報告 Editable Interactive Report

gin where 表格 報告 查詢 查詢語句 item 提醒 lis

據筆者所知。Apex 4.x 是沒有提供可編輯交互報告組件的。這就須要我們手動實現。

事實上這也並非非常復雜,僅僅須要簡單幾步。

1. 依據向導建立一個interactive report。查詢語句能夠例如以下。

select apex_item.hidden(1,e.id) || e.name as staff, apex_item.select_list_from_lov(p_idx=>2,p_value=>e.department_id,p_lov=>‘lov_department‘) as department from employee e;
這裏的關鍵是使用APEX_ITEM.SELECT_LIST_FROM_LOV用於表格編輯。當然。lov_department須要提前建立好。

2. 創建一個button用於提交頁面。

3. 創建一個"After Submit‘ PLSQL process

begin
FOR i IN 1 .. apex_application.g_f01.COUNT LOOP
update employee set department_id=apex_application.g_f02(i) where id=apex_application.g_f01(i);
END LOOP;
end;
這裏須要提醒的是序號匹配。也就是說,g_f01指向APEX_ITEM.HIDDEN(1,e.id), g_f02指向 apex_item.select_list_from_lov(p_idx=>2
,p_value=>e.department_id,p_lov=>‘lov_department‘) 。註意斜體和帶下劃線的數字部分。

Oracle Apex 有用筆記系列 6 - 可編輯交互報告 Editable Interactive Report