0937-0940

Previous Table of Contents Next

Page 937

CHAPTER 38

Developer/2000 Integration

IN THIS CHAPTER

  • Displaying Oracle Graphics in Oracle Forms 938
  • Executing Oracle Reports from Oracle Forms 940
  • Displaying Oracle Graphics in Oracle Reports 941
  • Interfacing to Non-Oracle Applications 942
  • Interfacing with the Windows API and Other DLLs 944

Page 938

The previous three chapters discussed the Developer/2000 components as independent, stand-alone tools. Based on Oracle's concept of the open-enterprise connectivity, each of the Oracle tools was designed to be combined into a multi- faceted , integrated application. Oracle Forms can display graphics on the presentation canvas, and reports can be spawned from within the tool. Additionally, Oracle Reports can display an Oracle Graphics chart directly in the report. In addition to the capability of the Developer/2000 tools to work with each other, the Oracle tools have the capability to work in an integrated environment with other compatible non-Oracle applications.

This chapter describes the steps necessary to produce these integrated applications quickly.

Displaying Oracle Graphics in Oracle Forms

You can integrate Oracle Graphics charts into an Oracle Forms module using specific forms objects and built-in procedures and functions. Figure 38.1 shows an example of a module that integrates these tools. In this form, the annual sales for all warehouses are shown in standard form text fields, and a pie chart that indicates the relative contribution of each warehouse is shown next to the text items. Below these text items, a bar chart shows the monthly shipments for the current warehouse. The user can click any of the pie segments to select a record in the form. Additionally, if the user selects any record in the form, the bar chart changes to show data for the new warehouse.

Figure 38.1.
Integrated Oracle Forms and Oracle Graphics module.


Page 939

To build this module, first build the two graphics modules using the Oracle Graphics Designer. The first chart should be based on the following query:

 select hist_wh_code,           sum (hist_ord_shipped) Shipments,   from warehouse_history  where hist_year = 1994  group by hist_wh_code; 

Next, define a pie chart for this query using the pie with depth attribute. After the pie chart is displayed in the Layout Editor, double-click one of the pie segments to present the trigger-definition form for the pie slices. Select the drill-down tab, and set this item to set the P_wh_code parameter equal to hist_wh_code on a mouse-down trigger. (Note that you do not select a query for the drill-down trigger.)

The next chart is a bar chart with shadow and is based on the following query:

 select to_char (to_date (to_char (hist_month_no), `MM'), `MON') Month,           hist_ord_shipped Shipments   from warehouse_history  where hist_year = 1994      and hist_wh_code = :P_wh_code; 

The P_wh_code parameter holds the value for the warehouse code for the chart.

Now, create the form for the WH_ANNUAL_SHIPS view displaying the warehouse name and total annual shipments for 1994. Next, create a control block to hold the chart items, and using the chart item tool in the Layout Editor, create the two areas for the Graphics charts on the canvas. You link these items to the Graphics modules using PL/SQL. To use the Oracle Graphics built-in program units, you must attach the OG.PLL library to the form.

The first trigger that you should create is the WHEN-NEW-FORM-INSTANCE trigger that sets up the charts as soon as the form is started. The bar chart requires parameters to define the warehouse that should be displayed in the chart. You should define this trigger as follows :

 declare         plist        ParamList;      begin         execute_query;         OG.Open (`g39oun01.ogd', `CONTROL.PIE_CHART', FALSE);         plist := Create_parameter_list (`chart_parms');         Add_parameter (plist, `P_wh_code', TEXT_PARAMETER,                               :wh_annual_ships.wh_code); OG.Open (`g39oun02.ogd', `CONTROL.BAR_CHART', FALSE, TRUE, plist);         Destroy_parameter_list (plist);      end; 

The parameters for the OG.Open procedure are the chart module name, form display object, clip indicator, refresh indicator, and parameter list ID. If you define the clip indicator in this procedure call as FALSE, the chart is included on the form by scaling it to fit within the defined

Page 940

area. The default value of TRUE causes the chart to be clipped to fit within the display. Now, you must build the mouse-down trigger interface in the form. For the PIE_CHART item, create a WHEN_MOUSE_CLICK procedure as follows:

 declare         wh     VARCHAR2(3);         plist    ParamList;      begin         OG.mouse_down (`g39oun01.ogd', `CONTROL.PIE_CHART');         wh := OG.GETCHARPARM (`g39oun01.ogd', `CONTROL.PIE_CHART',                                                                   `P_wh_code'); go_block (`WH_ANNUAL_SHIPS');         loop            if wh = :WH_ANNUAL_SHIPS.WH_CODE then               exit;             end if;            next_record;         end loop;         plist := create_parameter_list (`chart_parms');         add_parameter (plist, `P_wh_code', TEXT_PARAMETER, wh);         OG.REFRESH (`g39oun02.ogd', `CONTROL.BAR_CHART', plist);         destroy_parameter_list (plist);      end; 

The GETCHARPARAM function extracts the parameter from the first chart, and the OG.REFRESH procedure passes the new parameter value to the second chart.

NOTE
One thing to note when working with Graphics in Oracle Forms is that the displays might look different when displayed in Forms, especially when the chart is scaled to fit within the chart area. The primary problem relates to the text labels on a chart due to the fact that Oracle Forms tries to use the closest -fitting font to the defined display, often resulting in overlapping labels. The best advice is to define the chart with the smallest possible fonts and hope for the best. Honestly, building forms where everything fits properly can be done, but it requires a significant effort. Also, when building the chart, define the chart area as approximately the same size as it will be in the integrated module.

Executing Oracle Reports from Oracle Forms

Printing an Oracle Reports 2.5 report from Oracle Forms requires the use of a single built-in procedure, RUN_PRODUCT. To demonstrate this concept, open the form that was created in Chapter 35, "Oracle Forms," in the section on multi-block relationships. This form was used to enter new orders into the system. The boilerplate graphics report that was built in Chapter 36, "Oracle Reports," was a shipping document for an order. These two modules are integrated using a

Previous Table of Contents Next


Oracle Unleashed
Oracle Development Unleashed (3rd Edition)
ISBN: 0672315750
EAN: 2147483647
Year: 1997
Pages: 391

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net