Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1569
  • Last Modified:

CHECKBOX IN BLOCK ORACLE FORM6i

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
oracle_trainee
Asked:
oracle_trainee
1 Solution
 
Helena Markováprogrammer-analystCommented:
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
 
venkat_idCommented:
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
 
venkotchCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
oracle_traineeAuthor Commented:
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
 
venkotchCommented:
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
 
oracle_traineeAuthor Commented:
thanks... any oracle tutorials sites...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Tackle projects and never again get stuck behind a technical roadblock.
Join Now