Friday 26 September 2014

we can easily transfer data from one block to another block in oracle forms using checkbox with image.


check the code below

>> transfer data from one block to another block only selected data
begin

go_block('fromcustomer_block');
 first_record;

  loop
    go_block('tocustomer_block');
    if :fromcustomer_block.ck_from = 'Y' then
     :tocustomer_block.to_cust_name := :fromcustomer_block.from_cust_name;
:tocustomer_block.to_cust_code := :fromcustomer_block.from_cust_code;
 :tocustomer_block.ck_to :='Y';
 end if;
     next_record;

     go_block('fromcustomer_block');
      exit when :system.last_record = 'TRUE';
      next_record;    
  end loop;
  first_record;
  go_block('tocustomer_block');
  first_record;
  
  end;

<< removing data from another block only selected data

begin
    go_block('tocustomer_block');
            first_record;
LOOP
if :tocustomer_block.ck_to = 'Y'   then
clear_record;
end if;
EXIT WHEN :SYSTEM.LAST_recORD='TRUE';
Next_Record;
END LOOP;

  end;

Update Code:

begin
if :SALESEXECUTIVE_BLOCK.to_se_code is null then 
     libpkg_general.msgbox('please select the sales exicutive to update', 'Sales');
     return;
        end if;
go_block('tocustomer_block');
if :tocustomer_block.to_cust_code is null then 
libpkg_general.msgbox('Please Tranfer the Customer first', 'Sales');
return;
end if;
if :SALESEXECUTIVE_BLOCK.ck_toselect = 'Y' and :tocustomer_block.to_cust_code is not            null  and   :tocustomer_block.ck_to = 'Y' then
first_record;
loop
if :tocustomer_block.ck_to = 'Y' then
update customer set sales_person2 = :SALESEXECUTIVE_BLOCK.to_se_code where 
code = :tocustomer_block.to_cust_code;
EXIT WHEN :SYSTEM.LAST_recORD='TRUE';
end if;
Next_Record;
END LOOP;
else
libpkg_general.msgbox('Atleast select one ccustomer', 'Sales');
return;
end if;
commit;
              libpkg_general.msgbox('Updaed Successfully', 'Sales');
end;


0 comments:

Post a Comment

Copyright © ORACLE-FORU - SQL, PL/SQL and ORACLE D2K(FORMS AND REPORTS) collections | Powered by Blogger
Design by N.Design Studio | Blogger Theme by NewBloggerThemes.com