Solved

CHECKBOX IN BLOCK ORACLE FORM6i

Posted on 2002-04-14
6
1,559 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á
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
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
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 50 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Require data to appear on a single line 2 70
PL/SQL Two changes 7 34
Error querying database link from Oracle 10g to Postgresql 7 69
Checking for column width 8 29
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Via a live example, show how to take different types of Oracle backups using RMAN.

828 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