32
Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table and graph utilizing two report queries. Time to Complete Approximately 15 minutes Topics This tutorial covers the following topics: Overview Prerequisites Creating a Report Query With Multiple Queries Creating a Report Layout Using Oracle BI Publisher Desktop Invoking the Report from an Application Page Summary Viewing Screenshots Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.) Note: Alternatively, you can place the cursor over an individual icon in the following steps to load and view only the screenshot associated with that step. You can hide an individual screenshot by clicking it. Overview Beginning with Oracle Application Express 3.1, a Report Query can contain more than one query. This allows you to easily create a PDF file that contains the results of multiple queries. In this tutorial, you will create a Report Query with two queries. The Report Layout consists of a table and a graph in one report layout. When the report is executed, the PDF file will contain two reports in the one document. Back to Topic List Prerequisites Before you perform this tutorial, you should: 1. Install Oracle Database 11g. 2. Install Oracle BI Publisher. See document PDF Printing. 3. Install Oracle BI Publisher Desktop.

Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

Creating a PDF Report with Multiple Queries

Purpose

This tutorial shows you how to create a PDF report that contains a table and graph utilizing two report queries.

Time to Complete

Approximately 15 minutes

Topics

This tutorial covers the following topics:

OverviewPrerequisitesCreating a Report Query With Multiple Queries Creating a Report Layout Using Oracle BI Publisher DesktopInvoking the Report from an Application Page Summary

Viewing Screenshots

Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.)

Note: Alternatively, you can place the cursor over an individual icon in the following steps to load and view only the screenshot associated with that step. You can hide an individual screenshot by clicking it.

Overview

Beginning with Oracle Application Express 3.1, a Report Query can contain more than one query. This allows you to easily create a PDF file that contains the results of multiple queries. In this tutorial, you will create a Report Query with two queries. The Report Layout consists of a table and a graph in one report layout. When the report is executed, the PDF file will contain two reports in the one document.

Back to Topic List

Prerequisites

Before you perform this tutorial, you should:

1. Install Oracle Database 11g. 2. Install Oracle BI Publisher. See document PDF Printing.3. Install Oracle BI Publisher Desktop.

Page 2: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

4. Configure Oracle Application Express for Advanced Report Printing. See document PDF Printing.5. Download and unzip the apexprnt.zip into your working directory. 6. Install Microsoft Word. Note that this OBE is only supported on Windows because of this requirement. 7. Install the Flash Player from Adobe. 8. Import the Printing Application in Application Builder using the printapp.sql file located in the directory where

you unzipped the file in the previous step.

Note: Within your development environment, in order for Oracle BI Publisher Desktop to work, Microsoft Word needs to be installed. For end users to run the resulting application, the Oracle BI Publisher Desktop is not needed. Just the appropriate application to open the file your application produces is needed; PDF reader, MS Word, MS Excel, etc.

Back to Topic List

Creating a Report Query With Multiple Queries

In this section, you create a Report Query with multiple queries. Perform the following steps:

1. Enter the following URL to log in to Oracle Application Express (change the <hostname> to localhost, your specific hostname or apex.oracle.com).

http://<hostname>:8080/apex

2. To log in to Oracle Application Express, enter the following details, and click Login.

Workspace: <your workspace name> Username: <your username> Password: <your password>

Page 3: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

3. On the Workspace home page, click Application Builder.

4. Select Printing Application.

5. Click Shared Components.

Page 4: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

6. Under Reports, click Report Queries.

7. Click Create.

Page 5: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

8. Enter multiquery for the Name and click Next.

9. Click Query Builder to create the query.

10. From the list of queries, select OEHR_EMPLOYEES.

Page 6: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

11. Select the check box in front of each of the following columns and click Return.

FIRST_NAMELAST_NAMEEMAILHIRE_DATEJOB_IDSALARY

Page 7: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

12. Your SQL Query is shown. Click Next.

Page 8: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

13. You want to add another query, click Add Query.

14. Click Query Builder again.

15. Select OEHR_DEPARTMENTS and OEHR_EMPLOYEES.

Page 9: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

16. To create the join condition, Drag OEHR_DEPARTMENTS.MANAGER_ID over OEHR_EMPLOYEES.EMPLOYEE_ID.

Page 10: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

17. Select the check box in front of each of the following columns and click Return.

OEHR_DEPARTMENTS.DEPARTMENT_NAMEOEHR_DEPARTMENTS.MANAGER_IDOEHR_EMPLOYEES.FIRST_NAMEOEHR_EMPLOYEES.LAST_NAMEOEHR_EMPLOYEES.SALARY

18. To create the query, click Create.

Page 11: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

19. The queries have been defined. In the next section of this tutorial, you create the report layout using Oracle BI

Publisher Desktop.

Back to Topic List

Creating a Report Layout Using Oracle BI Publisher Desktop

In this section, you create a Report Layout based on the multiple queries using Oracle BI Publisher Desktop. Perform the following steps:

Page 12: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

1. From the Source Queries page in the Report Query wizard, click Download.

2. Click Save and save the file as the default name multiquery.xml. Then close the download window.

Page 13: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

3. Open Microsoft Word. Select Oracle BI Publisher > Data > Load Sample XML Data...

4. Select multiquery.xml and click Open.

Page 14: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

5. The data was loaded successfully. click OK.

Page 15: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

6. Select Oracle BI Publisher > Insert > Table/Form...

7. You want all the columns under Rowset1Row to appear in the table. Drag Rowset1 Row to the Template area.

Page 16: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

8. Select Drop All Nodes.

Page 17: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

9. To create the table, click OK.

10. The table is shown.

11. Resize the columns and add a Title.

Page 18: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

12. You now want to create a chart using the second query. Select Oracle BI Publisher > Insert > Chart...

13. Under Rowset2 Row, drag Salary to Values.

Page 19: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

14. Drag Department Name to Labels.

Page 20: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

15. Select Pie Chart for Type. Scroll down to the Title field and enter Total Salary Percentage by Department. Click

OK.

16. The chart is displayed.

Page 21: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

17. You need to save your layout as an RTF file. Select File > Save As... Select Rich Text Format (*.rtf) for Save as

Type, enter multiquery.rtf for File Name and click Save.

Page 22: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

18. Switch back to Application Express and click Next.

Page 23: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

19. Click Browse... to select the RTF file you just created. Select the multiquery.rtf file and click Open.

20. Click Next.

21. In order to test your report, you need to first start BI Publisher. Double-click the Start BI Publisher icon on your

desktop

Page 24: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

22. To test your report, click Test Report.

23. When the dialogue appears, click Open.

Page 25: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

24. The table is populated with data, scroll down to see the chart.

Page 26: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

25. Close the PDF report. On the Create Shared Query page, click Finish.

26. Your Report Query and Report Layout were created successfully. In the next section, you create a button on a page

that invokes the report.

Back to Topic List

Invoking the Report from an Application Page

In this section, you invoke the report query from a page in your application. Perform the following steps:

Page 27: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

1. Navigate to your Printing Application page. Click the Home page.

2. Click the Create Button icon.

Page 28: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

3. Select the Home region and click Next.

4. Accept the default and click Next.

5. Enter Print Report for Button Name and select Download printable report query for Action and click Next.

Page 29: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

6. Accept the default and click Next.

7. Select [Top] from the list of quick links or select Top of Region from the drop down list and select Left for

Alignment and click Next.

8. Select multiquery for the Report Query and click Create Button.

Page 30: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

9. You button was created successfully. Click Run.

10. You may be asked to login to the application. Enter your username and password and click Login.

11. Click Print Report.

Page 31: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

12. Click Open to open the PDF report.

13. The report is displayed.

Page 32: Creating a PDF Report with Multiple Queries - Oracle...Creating a PDF Report with Multiple Queries Purpose This tutorial shows you how to create a PDF report that contains a table

Back to Topic List

Summary

In this tutorial, you learned how to:

Create a report query with multiple queriesCreate a report layout using Oracle BI Publisher DesktopInvoke a report from an application page

Back to Topic List

Place the cursor over this icon to hide all screenshots.