Previous  Next          Contents  Index  Navigation  Glossary  Library

Example of Implementing Zoom Using the CUSTOM Library

Here is an example of a simple customization you can do with the Zoom feature (in the CUSTOM library).

Note: This Zoom demo/example is based on the training class form DEMXXEOR used in the class "Develop Extensions to Oracle Applications" (available through Oracle Education Services). The form files can be found on the Release 10SC Production 13 (and later) Development Kit CD-ROM, installable using the Oracle Installer file WINDOWS.PRD that you find under the ALPHAINS directory. The product name to install is "Training Class Forms (Develop Extensions to Oracle Applications)". See the Readme.txt file included for setting up the corresponding tables and views in your database.

The DEMXXEOR form is a very simple form for entering orders. In this example, we add two parameters (ORDER_ID and CUSTOMER_NAME) to the form that can be accepted from Zoom upon form startup. The form then fires an automatic query based on the parameters if one of the parameters has a value.

For the Zoom itself, we make Zoom available from the first block of the same form. The user can have a value in one or both of the Order Number and Customer Name fields. When the user clicks on the Zoom button, Zoom opens another session of the same form and automatically queries up any existing orders fitting the criteria.

Once you understand how this Zoom works and is implemented, you should be able to take the same approach with other forms (not necessarily zooming to another session of the same form).

Modify the Form

Using the Oracle Forms Designer, modify the Demo Orders form (DEMXXEOR.fmb) so it is able to receive parameter(s) from the Zoom code.

Note: The DEMXXEOR form shipped on the Release 10SC Production 15 (and later) Development Kit CD-ROM already has these modifications.

	WHERE (:parameter.order_id is null or
		dem_orders_v.order_id like :parameter.order_id)
	AND (:parameter.customer_name is null or
		dem_orders_v.customer_name like :parameter.customer_name)

	/* fire automatic query if a parameter has a value from Zoom */
	if (:parameter.order_id is not null) or
	   (:parameter.customer_name is not null) then
	/* clear the parameters after the query so they don't remain
		criteria for future queries */
	  :parameter.order_id := null;
	  :parameter.customer_name := null;
	end if;

Modify the CUSTOM Library

  -- Customize this package to provide specific responses to
  -- events within Oracle Applications forms.
  -- Do not change the specification of the CUSTOM package 
  -- in any way.
  function zoom_available return BOOLEAN is
  -- This function allows you to specify if zooms exist for the
  -- current context. If zooms are available for this block, then 
  -- return TRUE; else return FALSE. 
  -- This routine is called on a per-block basis within every
  -- Applications form. Therefore, any code that will enable 
  -- Zoom must test the current 
  -- form and block from which the call is being made. 
  -- By default this routine must return FALSE.
        form_name  varchar2(30) := name_in('system.current_form');
        block_name varchar2(30) := name_in('system.cursor_block'); 
        if (form_name = 'DEMXXEOR' and block_name = 'ORDERS') then
          return TRUE;
          return FALSE;
        end if;
  end zoom_available;
  function style(event_name varchar2) return integer is
  --  This Zoom example does not do anything to the STYLE function
    return custom.standard;
  end style;
  procedure event(event_name varchar2) is
  -- This procedure allows you to execute your code at specific
  -- events. 'ZOOM' or product-specific events will be passed
  -- in event_name. See the Applications Technical Reference
  -- manuals for a list of events that are available through 
  -- this interface.
        form_name  varchar2(30) := name_in('system.current_form');
        block_name varchar2(30) := name_in('system.cursor_block'); 
        param_to_pass1 varchar2(255);
        param_to_pass2 varchar2(255);
        if (event_name = 'ZOOM') then  
          if (form_name = 'DEMXXEOR' and block_name = 'ORDERS')
            param_to_pass1 := name_in('ORDERS.order_id');
            param_to_pass2 := name_in('ORDERS.customer_name');
		/* use fnd_function.execute instead of open_form */
                                '" CUSTOMER_NAME="'||
		/* all the extra single and double quotes account for
		   any spaces that might be in the passed values */
          end if;
        end if;
  end event;
END custom;

See Also

Customizing Oracle Applications with the CUSTOM Library

Writing Code for the CUSTOM Library

Events Passed to the CUSTOM Library

When to Use the CUSTOM Library

CUSTOM Library Package Procedures

Coding Zoom

Support and Upgrading

         Previous  Next          Contents  Index  Navigation  Glossary  Library