Tuesday, May 28, 2019

how to update data from apex report to database


select PID,
"ITEMCODE",
"ST_DT",
"USER_ID",
"STATUS" STTS,
apex_item.hidden(1,PID)||apex_item.text(42,remk) remk,
apex_item.checkbox(
p_idx => 43   --f43
,p_value => ROW_NUMBER() OVER (ORDER BY PID)
,p_ATTRIBUTES => NULL   --NOT CHECKED
) CHK
from "#OWNER#"."PRODUCT_CHK"
 
--apex_item.checkbox(1, "PID"||"ST_DT") Check1 , "PID",

page process 

declare
la_checked apex_application_global.vc_arr2;
procedure align_checkboxes
(
p_nbr_records          in  pls_integer,
p_html_checkboxes      in  apex_application_global.vc_arr2,
p_expanded_checkboxes  out apex_application_global.vc_arr2

--takes a dens list of checkbox selections of row numbers from html submission
--and convert to the number of elements as other arrays within the form
--eg: 5 records, 3rd record checked will only have p_html_checkboxes(1)=3
--this will return p_expanded_checkboxes(3)='Y' the rest 'N'
) is

begin
<<prime>>
for i in 1..p_nbr_records loop
p_expanded_checkboxes(i):='N';
end loop  prime;

<<align>>
for i in 1..p_html_checkboxes.count loop
p_expanded_checkboxes(p_html_checkboxes(i)):='Y';
end loop align;
end align_checkboxes;
begin

align_checkboxes(
apex_application.g_f01.count,   --hidden filed
apex_application.g_f43,         --dense checkboxes heading in
la_checked);                    --sparse array comming out

<<html_array>>

for i in 1..apex_application.g_f01.count
loop
if la_checked(i)='Y' then
update product_chK
set status='1' , remk=apex_application.g_f42(i)
where pid=TO_number(apex_application.g_f01(i));
end if;
end loop html_array;
apex_application.g_print_success_message :=apex_application.g_f43.count||'products update.';
end;

No comments:

Post a Comment

To generate a PDF using JavaScript in Oracle APEX from a collection

  To generate a PDF using JavaScript in Oracle APEX from a collection, you can follow these steps: 1. Create a button or link on your APEX p...