Solved

CHECKBOX IN BLOCK ORACLE FORM6i

Posted on 2002-04-14
6
1,555 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
6 Comments
 
LVL 22

Expert Comment

by:Helena Marková
Comment Utility
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
Comment Utility
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
Comment Utility
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:oracle_trainee
Comment Utility
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 50 total points
Comment Utility
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
Comment Utility
thanks... any oracle tutorials sites...
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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 copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now