This discussion is archived
6 Replies Latest reply: Nov 19, 2012 8:03 AM by ck RSS

Select all check box in multiple row

user620717 Newbie
Currently Being Moderated
Hi,
I am using form 6i.
I have multi row block where one item is as check box. Whenever user select three consecutive check box then automatically all check box will be checked.
Any three consecutive row........... either top, middle or bottom from any where, just three consecutive checkbox is selected then automatically all check box will be checked.......


Thanks in advance......
  • 1. Re: Select all check box in multiple row
    DanielB Pro
    Currently Being Moderated
    on the trigger when-checkbox-checked

    programming
    if checkbox_checked(:item) then
      :myvar:=myvar+1;
    else
      :myvar:=myvar-1;
    end if;
    if :myvar = 3 then
       do_check_all;
    end if;
    and
    do_check_all
    is a local procedure with
    first_record;
    while :system.last_record='FALSE' LOOP
      :mycheck := 1;
      next_record;
    END LOOP;
      :mycheck := 1;
  • 2. Re: Select all check box in multiple row
    user620717 Newbie
    Currently Being Moderated
    Thanks Daniel

    But not yet solved as bcoz from your answer, when user select any three row then it will check_all. but my question user will select any three continue, e.g. suppose my current_record is 2 so it will check for current_record+1 & also check for current_record+2, if it is not ok then it will check current_record+1 & also check for current_record-1 and if it also not checked then it will check current_record-1 & also check for current_record-2. so these three possibilities are there... If these possiblities are ok then it will check_all..... Pls help me....
    THanks in advance....
  • 3. Re: Select all check box in multiple row
    ck Explorer
    Currently Being Moderated
    hello,


    its your check box a number type? it that case then make checked value = 1 and uncheck = 0

    create one hidden summary item to get the total number of check box that selected.

    in the when-checkbox-checked trigger add this code
    if :checkbox = 1 then
      if not ok then
         :checkbox := 0;  // in this case you reset the total of checked box if not ok then you can continue again to check another record
      end if;

      if :blk.total = 3 and checked ok  then
             local_procedure;
        end if;
    end if;
    //local procedure
    first_record;
    loop
       :checkbox := 1; 
               next_record;
       exit when :system.last_record = 'TRUE';
    end loop;
    charles

    Edited by: ck on Nov 12, 2012 10:37 PM
  • 4. Re: Select all check box in multiple row
    yoonas Expert
    Currently Being Moderated
    Hi,

    Create a parameter and increment it each time user checks a checkbox, when it reaches three you can loop through records in the block and check all the check boxes

    Regards
    Yoonas
  • 5. Re: Select all check box in multiple row
    user620717 Newbie
    Currently Being Moderated
    Dear All
    Actually i want to check not only three records, it should be continous three records. for example:

    IF current_row is checked then
    IF current_row+1 = checked and current_row+2 = checked THEN
    DO_CHECK_ALL;
    ELSIF current_row+1 = checked and current_row-1 = checked THEN
    DO_CHECK_ALL;
    ELSIF current_row-1 = checked and current_row-2 = checked THEN
    DO_CHECK_ALL;
    END IF;
    END IF;

    Actually i am not able to get the item of current_row+1,current_row+2,current_row-1,current_row-2.

    pls help me....

    I shall be thankfull to allllllllllllllllllllllllllllllll......
  • 6. Re: Select all check box in multiple row
    ck Explorer
    Currently Being Moderated
    hello,

    Try This.. and plese refer to my previous post.
    declare
         cur_blk VARCHAR2(40) := :System.Cursor_Block;
         cur_rec NUMBER;      
         top_rec NUMBER;
         bk_id Block;           
         x number := 0;
    begin
         
         bk_id := Find_Block( cur_blk );
               
    if :checkbox = 1 then
                        
       cur_rec := Get_Block_Property( bk_id, CURRENT_RECORD);              
       top_rec := Get_Block_Property( bk_id, TOP_RECORD);              

    first_record;
    loop     
         x := 0;
    if :checkbox = 1 then       
              for i in 1..3 loop
                       if :checkbox = 1 then 
                                             x := x + 1;
                       else
                              x := x - 1;
                       end if;
                next_record;             
               exit when :checkbox = 0 or x = 3;          
              end loop; 
              
               if x = 3 then
                   first_record;
              loop
                                 :checkbox := 1; 
                                          next_record;
                 exit when :system.last_record = 'TRUE';
              end loop;
               end if;          
       end if;  
          next_record;  
       exit when :system.last_record = 'TRUE'; -- or x = 3;
       end loop; 
    end if;
    end;
    Please if it help you mark it correct accordingly.

    Charles

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points