Skip Headers

Oracle Business Intelligence Publisher Online Help
Release 10.1.3.4
Part Number E12602-01
Go to Table of Contents
Contents
Go to previous page
Previous
Go to next page
Next

Defining the Data Model for Your Report

This chapter covers the following topics:

Introduction

BI Publisher relies on XML data to format and publish your reports. BI Publisher supports multiple methods for retrieving this data for your report. Moreover, you can combine data from different sources into a single report.

About the Data Model Options

BI Publisher supports the following data model types:

Defining a SQL Query Data Set Type

the picture is described in the document text

  1. Select the Data Source for this data set. Select the Default Data Source (defined in the Report Properties) or select a new data source from the list.

  2. Select the Cache Result box if you wish to cache the results of the query for your session.

    By caching the results of the query, multiple templates can be applied to these results without requerying the data. This will enhance online performance. However, if the data is updated during the session, the user cannot view the new data via the View report page until the cache is cleared.

    Note: You can control the cache expiration time and the cache size through the configuration settings. See Setting Server Configuration Options for more information.

  3. Enter the SQL query or select Query Builder. See Using the Query Builder for information on the Query Builder utility.

Using the Query Builder

About Query Builder

Use the Query Builder to build SQL queries without coding. The Query Builder enables you to search and filter database objects, select objects and columns, create relationships between objects, and view formatted query results with minimal SQL knowledge.

The Query Builder page is divided into three sections:

Understanding the Query Builder Process

To build a query, perform the following steps:

Using the Object Selection Pane

In the Object Selection pane you can select a schema and search and filter objects.

To hide the Object Selection pane, select the control bar located between it and the Design pane. Select it again to unhide it.

Selecting a Schema

The Schema list contains all the available schemas in the data source. Note that you may not have access to all that are listed.

Searching and Filtering Objects

Use the Search field to enter a search string. Note that if more than 100 tables are present in the data source, you must use the Search feature to locate and select the desired objects.

Selecting Objects

The Object Selection pane lists the tables, views, and materialized views from the selected schema (for Oracle databases, synonyms are also listed). Select the object from the list and it displays on the Design pane. Use the Design pane to identify how the selected objects will be used in the query.

Supported Column Types

Columns of all types display as objects in the Design pane. Note the following column restrictions:

Adding an Object to the Design Pane

  1. Select an object.

    The selected object displays in the Design pane. An icon representing the datatype displays next to each column name.

  2. Select the check box for each column to include in your query.

    When you select a column, it appears on the Conditions tab. Note that the Show check box on the Conditions tab controls whether a column is included in query results. Be default, this check box is selected.

    To select the first twenty columns, click the small icon in the upper left corner of the object and then select Check All.

  3. To execute the query and view results, select Results.

    Tip: You can also execute a query using the key strokes CTRL + ENTER.

Resizing the Design and Results Pane

As you select objects, you can resize the Design and Results panes by selecting and dragging the gray horizontal rule dividing the page.

Removing or Hiding Objects in the Design Pane

To remove an object, select the Remove icon in the upper right corner of the object.

To temporarily hide the columns within an object, click the Show/Hide Columns icon.

Specifying Query Conditions

Conditions enable you to filter and identify the data you want to work with. As you select columns within an object, you can specify conditions on the Conditions tab. You can use these attributes to modify the column alias, apply column conditions, sort columns, or apply functions.

When you select a column to include in your query, it appears as a separate row in the Output pane. The following table describes the attributes available on the Conditions tab:

Condition Attribute Description
Up and Down Arrows Controls the display order of the columns in the resulting query.
Column Displays the column name.
Alias Specify an optional column alias. An alias is an alternative column name. Aliases are used to make a column name more descriptive, to shorten the column name, or prevent possible ambiguous references.
Condition The condition modifies the query's WHERE clause. When specifying a column condition, you must include the appropriate operator and operand. All standard SQL conditions are supported. For example:
>=10
='VA'
IN (SELECT dept_no FROM dept)
BETWEEN SYSDATE AND SYSDATE + 15
Sort Type Select ASC (Ascending)
or DESC (Descending).
Sort Order Enter a number (1, 2, 3, and so on) to specify the order in which selected columns should display.
Show Select this check box to include the column in your query results. You do not need to select Show if you need to add a column to the query for filtering only.
For example, suppose you wish to create following query:
SELECT ename FROM emp WHERE deptno = 10

To create this query in Query Builder:
  1. From the Object list, select EMP.

  2. In the Design Pane, select ename and deptno.

  3. For the deptno column, in Condition enter =10 and uncheck the Show check box.

Function Available argument functions include:
  1. Number columns - COUNT, COUNT DISTINCT, AVG, MAXIMUM,. MINIMUM, SUM

  2. VARCHAR2, CHAR columns - COUNT, COUNT DISTINCT, INITCAP, LENGTH, LOWER, LTRIM, RTRIM, TRIM, UPPER

  3. DATE, TIMESTAMP columns- COUNT, COUNT DISTINCT

Group By Specify columns to be used for grouping when an aggregate function is used. Only applicable for columns included in output.
Delete Deselect the column, excluding it from the query.

As you select columns and define conditions, Query Builder writes the SQL for you.

To view the underlying SQL, click the SQL tab

Creating Relationships Between Objects

You can create relationships between objects by creating a join. A join identifies a relationship between two or more tables, views, or materialized views.

About Join Conditions

When you write a join query, you specify a condition that conveys a relationship between two objects. This condition is called a join condition. A join condition determines how the rows from one object will combine with the rows from another object.

Query Builder supports inner, outer, left, and right joins. An inner join (also called a simple join) returns the rows that satisfy the join condition. An outer join extends the result of a simple join. An outer join returns all rows that satisfy the join condition and returns some or all of those rows from one table for which no rows from the other satisfy the join condition.

Note: See Oracle Database SQL Reference for information about join conditions.

Joining Objects Manually

Create a join manually by selecting the Join column in the Design pane.

  1. From the Object Selection pane, select the objects you want to join.

  2. Identify the columns you want to join.

    You create a join by selecting the Join column adjacent to the column name. The Join column displays to the right of the datatype. When your cursor is in the appropriate position, the following help tip displays:

    Click here to select column for join

  3. Select the appropriate Join column for the first object.

    When selected, the Join column is darkened. To deselect a Join column, simply select it again or press ESC.

  4. Select the appropriate Join column for the second object.

    When joined, line connects the two columns. An example is shown in the following figure:

    the picture is described in the document text

  5. Select the columns to be included in your query. You can view the SQL statement resulting from the join by positioning the cursor over the join line.

  6. Click Results to execute the query.

Saving a Query

Once you have built the query and executed it, select the Save button to return to the Report Editor. The query will appear in the SQL Query box.

Editing a Saved Query

Once you have saved the query from the Query Builder to the Report Editor, simply select Query Builder again to edit the query. The Query Builder will parse the query and present it for modification in the Query Builder interface.

Defining an HTTP Data Set Type

Using the HTTP data source type you can create reports from RSS feeds over the Web.

Note that if you want to include parameters for an HTTP (XML feed), you must define the parameters first, so that they are available for selection when setting up the data source. See Adding Lists of Values and Parameters.

the picture is described in the document text

Defining a Web Service Data Set Type

BI Publisher supports document/literal Web service data sources that return the following data types:

Tip: If the WSDL URL is outside of your company firewall you must start the BI Publisher sever using proxy parameters.

BI Publisher supports Web services that return both simple data types and complex data types. You must make the distinction between simple and complex when you define the Web service data model. See Adding a Simple Web Service and Adding a Complex Web Service for descriptions of setting up each type.

Note that if you want to include parameters for the Web service method, you must define the parameters first, so that they are available for selection when setting up the data source. See Adding Parameters and Lists of Values.

Multiple parameters are supported. Ensure the method name is correct and the order of the parameters matches the order in the method. If you want to call a method in your Web service that accepts two parameters, you must map two parameters defined in the report to those two. Note that only parameters of simple type are supported, for example, string and integer.

Adding a Simple Web Service Example

This example shows how to add a Web service to BI Publisher as a data source. The Web service returns stock quote information. The Web service will pass one parameter: the quote symbol for a stock.

The WSDL URL is:

http://www.webservicex.net/stockquote.asmx?WSDL

If you are not already familiar with the available methods and parameters in the Web service that you want to call, you can open the URL in a browser to view them. This Web service includes a method called GetQuote. It takes one parameter, which is the stock quote symbol.

To add the Web service as a data source:

  1. Enter the Data Set information:

    the picture is described in the document text

  2. Define the parameter to make it available to the Web service data set.

    Select Parameters on the Report definition pane and click New to create a new parameter. Enter the following:

  3. Return to your Web service data set and add the parameter.

  4. To view the results XML, select View. Enter a valid value for your Stock Quote parameter and select View again.

    the picture is described in the document text

Adding a Complex Web Service

You can also add a complex Web service to BI Publisher as a data source. A complex Web service returns complex data types rather than simple string XML.

To use a complex Web service as a data source, select Complex Type equal True, then enter the WSDL URL. After loading and analyzing the WSDL URL, the Report Editor screen will display the available Web services and operations. For each selected operation, the Report Editor will display the structure of the input parameters. By choosing "show optional parameters", you can see all optional parameters as well.

If you are not already familiar with the available methods and parameters in the Web service that you want to call, you can open the URL in a browser to view them.

To add a complex Web service as a data source:

  1. Enter the Data Set information:

  2. Define the parameter to make it available to the Web service data set.

    Select Parameters on the Report definition pane and click New to create a new parameter. Enter the following:

  3. Return to your Web service data set and add the parameter.

  4. To view the results XML, select View. Enter a value for your parameter and select View again.

Defining a Data Template Data Set Type

Use the BI Publisher data template to create more complex SQL queries. See Building a Data Template for features and usage. Please note that lexical parameters are only supported when executing a query against an Oracle E-Business Suite instance.

Enter the data template code directly in the Data Template text box, or copy and paste the data template from another text source.

Important: If copying the data template, the entry in the text box must begin with the <dataTemplate> element. Do not include the XML declaration.

the picture is described in the document text

Defining an Oracle BI Answers Request Data Set Type

If you have enabled integration with Oracle Business Intelligence Presentation Services, then you can access the BI catalog to select an Oracle BI Answers request as a data source. Oracle BI Answers is an ad hoc query building tool included in the Oracle Business Intelligence Enterprise Edition. For more information on building Oracle BI Answers see the Oracle Business Intelligence Answers, Delivers, and Interactive Dashboards User Guide.

  1. Choose Oracle BI Answers as the data set Type.

    Note: BI Publisher does not support lists of values and parameters for the Oracle BI Answers request data set type.

  2. Select the browse icon to connect to the Oracle BI Answers catalog. This action displays the folders you have access to on the Oracle BI Presentation Services server.

    Note: You must set up integration with Oracle BI Presentation Services to enable Oracle BI Answers as a data set Type. See

  3. Select the Answers request you wish to use as the data set for your report.

    the picture is described in the document text

  4. Select the Cache Result box if you wish to cache the results of the query for your session.

    By caching the results of the query, multiple templates can be applied to these results without requerying the data. This will enhance online performance. However, if the data is updated during the session, the user cannot view the new data via the View report page until the cache is cleared.

    Note: You can control the cache expiration time and the cache size through the configuration settings. See Setting Server Configuration Options for more information.

Defining an Oracle BI Discoverer Data Set Type

For integration with BI Discoverer, you must configure the data source through the Oracle BI Discoverer tab on the Integration page from the Oracle BI Publisher Admin page. See Setting Up Integration with Oracle BI Discoverer for prerequisites, limitations, and setup details.

Note: A data model can include only one data set based on a Discoverer Worksheet.

To define the Discoverer Data Set Type:

  1. Select Oracle BI Discoverer from the Data Set Type list. This will enable the appropriate Details region for the Discoverer data source.

    the picture is described in the document text

  2. Enter the Details:

    Note: Regardless of whether the Discoverer worksheet is a tabular or crosstab layout, the Discoverer Web service will return the data to Oracle BI Publisher as flat tabular data. This is by design so that you can take full advantage of the layout capabilities in BI Publisher. You can layout this data as a crosstab in BI Publisher.

  3. Save your report.

  4. Click View to ensure that the Discoverer Worksheet you selected returns data to the report. If your worksheet contains parameters, you may need to select values other than the default and click View again to enable the worksheet to return data.

Defining a File as a Data Set Type

When you set up data sources (see Setting Up Data Sources) you can define a file directory as a data source. You can then place xml documents in the file directory to access directly as data sources for your reports.

  1. Choose File as the data set Type.

  2. Choose the appropriate file directory as the Data Source.

  3. Enter the File Name of the XML document to use as the report data set. If the file resides in a subdirectory, include the path.

    the picture is described in the document text

Defining an MDX Query Data Set Type

BI Publisher supports Multidimensional Expressions (MDX) queries against your OLAP data sources. MDX lets you query multidimensional objects, such as cubes, and return multidimensional cellsets that contain the cube's data. See your OLAP database documentation for information on the MDX syntax and functions it supports.

the picture is described in the document text

  1. Select the Data Source for this data set. Select the Default Data Source (defined in the Report Properties) or select a new data source from the list. Only data sources defined as OLAP connections will display in the list.

  2. Select the Cache Result box if you wish to cache the results of the query for your session.

    By caching the results of the query, multiple templates can be applied to these results without requerying the data. This will enhance online performance. However, if the data is updated during the session, the user cannot view the new data via the View report page until the cache is cleared.

    Note: You can control the cache expiration time and the cache size through the configuration settings. See Setting Server Configuration Options for more information.

  3. Enter the MDX query by direct entry or by copying and pasting from a third-party MDX editor.

  4. Click Save.

  5. Test your query by selecting the View link. This will launch the Report Viewer page. Select View again to display the data set returned by your query.

  6. Select the Edit link to return to the Report Editor.