I'm using Apex 21.2 on a 21.C database. I can't read the values that the user has checked when I execute a PL/SQL dynamic action.
The Checkbox Group field is called P302_MINISTRY_GROUP
.
The Type = Checkbox Group
. The LOV SQL Query = Select ministry || ' - ' || role display, prim_key return from vol_ministry order by ministry, role;
I did not put anything into the Source, Default, or Server Side Conditions. I created a dynamic action that fires when the user presses the "Save" button.
For the TRUE Action = Execute Server-side Code
. The PL/SQL code is:
declare
l_dummy number;
l_volunteer_pk number;
begin
l_volunteer_pk := :P302_PRIM_KEY;
for cur_r in (select * From table(apex_string.split(:P302_MINISTRY_GROUP, ':')))
loop
select prim_key
into l_dummy
from vol_contact_ministry where ministry_fkey = cur_r.column_value
and contact_fkey = l_volunteer_pk;
if l_dummy is null then
-- checked value does not exist
insert into vol_contact_ministry (ministry_fkey, contact_fkey, status)
values (cur_r.column_value, l_volunteer_pk, 'Active');
--else
-- checked value exists
-- delete from vol_contact_ministry where ministry_fkey = cur_r.column_value
-- and contact_fkey = l_volunteer_pk;
end if;
end loop;
end;
The checkboxes display on the screen with the concatenated fields just fine. When the user checks one or more boxes and presses "Save", I would expect that the PL/SQL would loop through the checked boxes and give the prim_key associated with that box. But I can't seem to get any values at all. As a test I tried inserting the entire field :P302_MINISTRY_GROUP but the table shows Null for that insert. The PL/SQL is firing properly when the button is pressed based on other tests that I made, but I can't get this code above to work. How do I obtain the values of checked boxes from a Checkbox Group so that I can manipulate it in PL/SQL ?
Aucun commentaire:
Enregistrer un commentaire