Powered By Blogger

বুধবার, ১ জুন, ২০২২

Lock/unlock block for editing/deleting and alert before deleting.

--Procedure to lock 
PROCEDURE P_block_record IS
v_CurrBlock block;
cur_blk varchar2(40) :=:System.Cursor_Block;
BEGIN
v_CurrBlock := Find_Block(cur_blk);
set_block_property(v_CurrBlock, update_allowed, property_false);
set_block_property(v_CurrBlock, delete_allowed, property_false);
EXCEPTION
WHEN others THEN
p_Message('Exception occured. Contact with Administrator');
END;
Call the above mentioned procedure on when-new-record-instance
-- Procedure to unlock
PROCEDURE P_UNBLOCK_RECORD IS
v_CurrBlock block;
cur_blk varchar2(40) :=:System.Cursor_Block;
BEGIN
v_CurrBlock := Find_Block(cur_blk);
set_block_property(v_CurrBlock, update_allowed, property_true);
set_block_property(v_CurrBlock, delete_allowed, property_true);
EXCEPTION
WHEN others THEN
p_Message('Exception occurred. Contact with Administrator');
END;
Call the above mentioned procedure to unlock on key-print or when you want
Create an alert named 'ask' 2 button yes/no.
Create the procedure on key-delrec for warning
DECLARE
   nalertbutton   NUMBER;
BEGIN
   SET_ALERT_PROPERTY ('ask',
                       alert_message_text,
                       'You''re going to delete record, Confirm Yes or No?');
   -- after below statement the execution will hold till you click on ok.. becuase it is an modal window
   nalertbutton := SHOW_ALERT ('ask');
   -- now check which button or answer have been choosen
   IF nalertbutton = alert_button1
   THEN
      DELETE_RECORD;
   ELSE
      RAISE form_trigger_failure;
   END IF;
-- after this you can perform any task...
END;

Row-level “Add” icon using a virtual column (APEX-safe)

1️⃣ Enable Insert in the Interactive Grid IG → Attributes Edit → Allowed Add Row → Yes 2️⃣ Add a New Column (Icon column) Column...