Hire me on UpWork

Friday, February 17, 2012

Oracle Searching at Forms, With Individual LOV

Do you want to search in every field in form ? Don't want to memorize each filed value ? Want to select the value from LOV (List of Values) ?

Ok. I will discuss, how can you do this.
For example, We have three filed named, department_id, department_name,location. We want to search in form in Enter Query mode. Instead of writing the value, we want to select it from LOV.

First, you need to create LOV for each and every filed for our form  filed and assign to the item.
Write Key-Listval trigger for each item and write the following code

if :system.mode='ENTER-QUERY' THEN
LIST_VALUES;
end if;

This will prevent the item to show LOV in any other mode and show only Enter-Query mode.

Now click on Enter-Query, Show your LOV(forms 6i= F9, 10g=Ctrl+L),select value and hit Execute-Query.

You are done.

If you don't like this try another way...Oracle Searching at Forms, Dynamic Way

Ma as'salama

Tuesday, February 7, 2012

How to Read Image File at Oracle Forms 10g ?

I heard and answered lot's of question. How i read image file from file system to Database in oracle forms 10g ?
Here is the solution.
First of all you have to configure webutil correctly. You need to configure formsweb.cfg, webutil.cfg
Attach the webutil.pll library at your forms. Make object group and subclass of webutil.pll
Now add a puss button to your form and write the following code at When-Button-Pressed trigger
--------------------------------------------
declare
 vfilename varchar2(300);
begin
 vfilename := client_get_file_name(file_filter => 'jpg(*.jpg,*.gif)|*.*');
 if vfilename is not null then
 client_image.read_image_file(vfilename,substr( vfilename,instr( vfilename, -1)),'COMPANY_INFO_MST.CIM_LOGO');
 client_image.write_image_file(vfilename,'','COMPANY_INFO_MST.CIM_LOGO'); 
 end if;
 
end;
-----------------------------------
set the following property of the image item.
image format: TIFF
sizing style: Adjust
 
You are done...  

Oracle Searching at Forms, Dynamic Way

We have 20 or more or less then 20 filed in our form. User like to search in the form based on all fields or frequently uses field. If user doesn't want to use "Query Mode" of Forms. How can we achieve this ?
1. Do we create a form with text field for referencing database filed ?
2. Write a complex Query using like operator or lexical parameter ? Or any other way ?

My choice is LOV (List of Values) and a Puss Button.

Create a LOV selecting column as you need. LOV return item should be one and better to be ID column. Don't assign it to any column.
Now at your search button create two trigger.

1. When-Button-Pressed and write something like to post the block state to enter query.
-------------------------------------------------------------------------------------------
BEGIN
 IF :SYSTEM.MODE = 'NORMAL' THEN 
  GO_BLOCK('ITEM_MST');
  CLEAR_BLOCK(NO_COMMIT);
  ENTER_QUERY;
 ELSIF :SYSTEM.MODE = 'ENTER-QUERY' THEN
  ENTER_QUERY;
 ELSIF :SYSTEM.MODE = 'QUERY' THEN 
  GO_BLOCK('ITEM_MST');
  CLEAR_BLOCK(NO_COMMIT);
  ENTER_QUERY;
 END IF;
 EXCEPTION 
  WHEN OTHERS THEN NULL;
END;
-----------------------------------------------------------------------------------------------------
2. When-Mouse-Click and call the LOV and execute query.
------------------------------------------------------------------------------------------------------
BEGIN 
 IF :SYSTEM.MODE = 'ENTER-QUERY' THEN 
  IF SHOW_LOV('CATEGORY_SEARCH') THEN 
   EXECUTE_QUERY;
  END IF;
 END IF;
 IF :System.Record_Status = 'NEW' THEN 
      Exit_Form(No_Validate); 
  END IF; 
END;
-------------------------------------------------------------------------------
 
You have done. 
Need more clarification ? Post your comments. :)