I am making a program with buttons.. and a data block...
clicking o the delete button it will display checkboxes at the left side of the record.. and clicking the confirm button it will delete the checked records... how can we trap if the user did not check any of the checkboxes and still the user click on the confirm button?
Who is Participating?
Exactly - if the user did not check anything, your variable Delete_Selection would be False, since you're setting this when Delete button pressed and before to Continue Delete.
It doesn't matter how many records you have displayed on the screen. The variable will tell you if AT LEAST ONE has been checked.
I don't know what is your approach but if you have multiple records displayed, you have to do a loop and go through all of them. The code of CONTINUE delete button would look like:

if Delete_Selection then
   v_Records_Deleted := 0;
   v_Process_Completed := False;
     v_Process_Completed = (:System.Last_Record='TRUE');
     if :My_Check_Box = 'CHECKED' then
        v_Records_Deleted := v_Records_Deleted + 1;
     end if;
     if NOT Process_Completed then
     end if;
     Exit When Process_Copleted;
   end LOOP;
   Message(v_Records_Deleted||' records successfully deleted.');
   Message('No records selected to delete.');
end if;

Hope this will help,
Helena Markováprogrammer-analystCommented:
In When-Button-Pressed trigger of the confirm button you can set enabled property of checkbox to false:


In When-Button-Pressed trigger of the delete button you can set enabled property of checkbox to true:


and also these two must be set:
hi there,
  do nothing while the user checks the check boxes.
once the user finished the selection for deleting the records and presses F10 or commit button u have provided on ur application. u put a loop and navigate thro' every rcd in that block and give DELETE_RECORD if the chk_box was checked.

go_block( <block_name>);
  IF NVL( :CHK_BOX, 'N')= 'Y' then
  end if;
  EXIT when :SYSTEM.last_record ='TRUE';

i think the above will suit ur need.
chk this out
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

I would suggest:
1) Create a library variable so to be shared within the whole form OR global variable OR parameter.
2) In WHEN-BUTTON PRESSED trigger of Delete button, when you displaying the check-boxes, Initialize this variable -

Delete_Selection := False;

3) Create WHEN-CHECK-BOX-CHANGED trigger on your check-box item. Use the followong code:

if NOT Delete_Selection then
   Delete_Selection := (:My_Check_Box = 'My_Checked_Value');
end if;

4) In your confirm button siply check whether Delete_Selection is true or false. False would mean that there is no records selected for delete.

However, the above logic will not catch situations such as check#1, then uncheck#1 record. The above logic will consider this as user change and still will say that Delete_Selection is True. To track such issue you will need more complicated logic - probably use of "array" (PL/SQL table) - instead of single variable.

Good Luck!
oracle_traineeAuthor Commented:
       i tried your code but the problem is how about if the user did not check the check box..  actually in my datablock i used the datablock wizard and 10 records are displayed in the form... so how can we trap if we have 10 checkboxes..?
oracle_traineeAuthor Commented:
thanks... any oracle tutorials sites...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.