Goog morning I have Apex page (form) based on table 'A' and need to add non-database 'Checkbox', if this checkbox is 'Y' , insert data into table 'B' if checkbox is 'N', delete data from table 'B' if found
so I add process with type 'Execute Pl code'
if :P1_checkbox = 'Y' then
delete from b where code = :P1_code ;
insert into b (code , topic ) values ( :P1_code, :P1_topic) ;
elsif (:P1_checkbox = 'N' ) then
delete from b where topic = :P1_code ;
end if ;
but it's not working, not given errors is there's another way!!
thanks in advance
so I add process with type 'Execute Pl code'
if :P1_checkbox = 'Y' then
delete from b where code = :P1_code ;
insert into b (code , topic ) values ( :P1_code, :P1_topic) ;
elsif (:P1_checkbox = 'N' ) then
delete from b where topic = :P1_code ;
end if ;
Process won't run just because you created it.
Usually, there's a button that submits the page; that action puts items' values into session state and you can reference them. Without it, maybe P1_CHECKBOX
is actually NULL
so IF-THEN-ELSE
doesn't do anything as all conditions are false.
Note that process has condition which says which button (when pressed) runs that process - set it to the submit button.
Code itself looks OK. If you do what I wrote earlier and it still doesn't work, then run page in debug mode and review debug info afterwards; it'll tell you what Apex did.