Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CHECKBOX IN BLOCK ORACLE FORM6i

Posted on 2002-04-14
6
Medium Priority
?
1,566 Views
Last Modified: 2007-11-27
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?
0
Comment
Question by:oracle_trainee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 22

Expert Comment

by:Helena Marková
ID: 6941149
In When-Button-Pressed trigger of the confirm button you can set enabled property of checkbox to false:

Set_Item_Property('your_item',ENABLED,PROPERTY_FALSE);

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

Set_Item_Property('your_item',ENABLED,PROPERTY_TRUE);

and also these two must be set:
Set_Item_Property('your_item',INSERT_ALLOWED,PROPERTY_TRUE);
Set_Item_Property('your_item',UPDATE_ALLOWED,PROPERTY_TRUE);
0
 

Expert Comment

by:venkat_id
ID: 6941605
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>);
LOOP
  IF NVL( :CHK_BOX, 'N')= 'Y' then
     delete_record;
  end if;
  EXIT when :SYSTEM.last_record ='TRUE';
  NEXT_RECORD;
END LOOP;

i think the above will suit ur need.
chk this out
venkat
0
 
LVL 6

Expert Comment

by:venkotch
ID: 6945964
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!
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:oracle_trainee
ID: 6950276
venkotch,
       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..?
0
 
LVL 6

Accepted Solution

by:
venkotch earned 200 total points
ID: 6951749
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
   Go_Block('MY_MULTI_RECORD_BLOCK');
   First_Record;
   v_Records_Deleted := 0;
   v_Process_Completed := False;
   LOOP
     v_Process_Completed = (:System.Last_Record='TRUE');
     if :My_Check_Box = 'CHECKED' then
        Delete_Record;
        v_Records_Deleted := v_Records_Deleted + 1;
     end if;
     if NOT Process_Completed then
        Next_Record;
     end if;
     Exit When Process_Copleted;
   end LOOP;
   First_Record;
   Message(v_Records_Deleted||' records successfully deleted.');
else
   Message('No records selected to delete.');
end if;

Hope this will help,
Venelin
0
 

Author Comment

by:oracle_trainee
ID: 6974649
thanks... any oracle tutorials sites...
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question