Skip Headers
Oracle® Business Intelligence Publisher
11g Release 1 (11.1.1)
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

Creating Data Sets

This chapter describes creating data sets in BI Publisher. Data sets can be created from a variety of sources including SQL queries, MDX queries, LDAP queries, Microsoft Excel worksheets, Web services, and XML files. This chapter also describes how to test your data models and save sample data.

This chapter includes the following sections:

Overview of Creating Data Sets

Oracle BI Publisher can retrieve data from multiple types of data sources.

to create a data set:

  1. On the component pane of the data model editor, click New Data Set as shown in Figure 13-1.

    Figure 13-1 Creating a Data Set

    Creating a data set
  2. Select the data set type from the list to launch the appropriate dialog, as shown in Figure 13-2.

    Figure 13-2 Selecting the Data Set Type

    Selecting the data set type
  3. Complete the required fields to create the data set. See the corresponding section in this chapter for information on creating each data set type.

Editing an Existing Data Set

To edit an existing data set:

  1. On the component pane of the data model editor click Data Sets. All data sets for this data model display in the working pane.

  2. Click the data set that you want to edit.

  3. Click Edit Selected Data Set. The dialog for the data set opens. For information about each type of data set, see the corresponding section in this chapter.

  4. Make changes to the data set and click OK.

  5. Save the data model.

  6. Test your edited data model and add new sample data. See Testing Data Models and Generating Sample Data for more information about testing and generating sample data.

Creating a Data Set Using a SQL Query

This section includes the following topics:

Entering SQL Queries

To enter a SQL query:

  1. Click New Data Set and then click SQL Query. The Create Data Set - SQL dialog opens, as shown in Figure 13-3.

    Figure 13-3 New Data Set - SQL Query Dialog

    Create data set SQL Dialog
  2. Enter a name for this data set.

  3. The data source defaults to the default data source that you selected on the Properties page. If you are not using the default data source for this data set, select the Data Source from the list.

    You can also use your private data source connections as data sources for SQL query data sets. See Managing Private Data Sources for information about private data source connections.

  4. Enter the SQL query or click Query Builder to launch the Query Builder page. See Using the SQL Query Builder for more information about the Query Builder utility.

  5. If you are using Flexfields, bind variables, or other special processing in your query, edit the SQL returned by the Query Builder to include the required statements.


    Note:

    If you include lexical references for text that you embed in a SELECT statement, then you must substitute values to get a valid SQL statement.


  6. After entering the query, click OK to save. The data model editor validates the query.

    If your query includes a bind variable, you are prompted to create the bind parameter. Click OK to have the data model editor create the bind parameter. To edit the parameter, see Chapter 15, "Adding Parameters and Lists of Values."

Using the SQL 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 two sections:

  • Object Selection pane contains a list of objects from which you can build queries. Only objects in the current schema display.

  • Design and output pane consists of four tabs:

    • Model — Displays selected objects from the Object Selection pane.

    • Conditions — Enables you to apply conditions to your selected columns.

    • SQL — Displays the query.

    • Results — Displays the results of the query.

    Figure 13-4 Design and Output Pane

    Design and Output Pane

Understanding the Query Builder Process

To build a query, perform the following steps:

  1. Select objects from the Object Selection pane.

  2. Add objects to the Design pane and select columns.

  3. (Optional) Establish relationships between objects.

  4. Add a unique alias name for any duplicate column.

  5. (Optional) Create query conditions.

  6. Execute the query and view results.

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 are used in the query.

Supported Column Types

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

  • You can select no more than 60 columns for each query.

  • Only the following column types are selectable:

    • VARCHAR2, CHAR

    • NUMBER

    • DATE, TIMESTAMP


      Note:

      The data type TIMESTAMP WITH LOCAL TIMEZONE is not supported.


    • Binary Large Object (BLOB)


      Note:

      The BLOB must be an image. When you execute the query in the Query Builder, the BLOB does not display in the Results pane; however, the query is constructed correctly when saved to the data model editor.


    • Character Large Object (CLOB)

      See Using Data Stored as a Character Large Object (CLOB) in a Data Model for more information about working with CLOB data in the data model.

Adding Objects to the Design Pane

To add objects to the design pane:

  1. Select an object.

    The selected object displays in the Design pane. An icon representing the data type 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:

  1. Click Remove in the upper right corner of the object.

To temporarily hide the columns within an object:

  1. Click Show/Hide Columns .

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. Figure 13-5 shows the Conditions tab.

Figure 13-5 Conditions Tab

Conditions tab

Table 13-1 describes the attributes available on the Conditions tab.

Table 13-1 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. Note that multibyte characters are not supported in the alias name.

Object

Displays the object name.

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 to add a column to the query for filtering only. For example, 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 clear the Show check box.

Function

Available argument functions include:

  • Number columns — COUNT, COUNT DISTINCT, AVG, MAXIMUM,. MINIMUM, SUM

  • VARCHAR2, CHAR columns — COUNT, COUNT DISTINCT, INITCAP, LENGTH, LOWER, LTRIM, RTRIM, TRIM, UPPER

  • 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:

  1. Select 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 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.

Joining Objects Manually

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

To join objects manually:

  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 data type. 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 Figure 13-6.

    Figure 13-6 Joined Columns

    Joined columns
  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, click Save to return to the data model editor. The query appears in the SQL Query box. Click OK to save the data set.

Figure 13-7 Query Displayed in SQL Query Box

Query inserted in SQL Query box

Adding a Bind Variable to a Query

Now you have a basic query, but in the report you want users to be able to pass a parameter to the query to limit the results. For example, in the employee listing, you want users to be able to choose a specific department.

You can add the variable using either of the following methods:

  • Add the bind variable using the Query Builder Conditions tab

    To add the bind variable in the Query Builder Conditions tab:

    1. Add the following Condition for the column:

      in (:P_DEPTNAME)
      

      where P_DEPTNAME is the name you choose for the parameter. This is shown in Figure 13-8.

    Figure 13-8 Adding the Bind Variable Using the Query Builder Conditions Tab

    Adding a bind variable
  • Update the SQL query directly in the text box.


    Important:

    After manually editing the query, the Query Builder can no longer parse it. Any further edits must also be made manually.


    To update the SQL query directly in the text box:

    1. Add the following after the where clause in your query:

      and "COLUMN_NAME" in (:PARAMETER_NAME)
      

      for example:

      and "DEPARTMENT_NAME" in (:P_DEPTNAME)
      

      where P_DEPTNAME is the name you choose for the parameter. This is shown in Figure 13-9.

      Figure 13-9 Editing the Generated SQL Query

      Editing the generated SQL query
    2. When you click Save, the data model editor prompts you to create the parameter that you entered with the bind variable syntax, as shown in Figure 13-10.

      Figure 13-10 Create a Bind Parameter Dialog

      Create a bind variable dialog
    3. Select the paramater, and click OK to have the data model editor create the parameter entry for you. See Chapter 15, "Adding Parameters and Lists of Values" for more information on defining parameter properties.

Editing a Saved Query

When you have saved the query from the Query Builder to the data model editor, you can also use the Query Builder to edit the query.

To use the Query Builder to edit the query:

  1. Select the SQL data set.

  2. On the toolbar, click Edit Selected Data Set to launch the Edit Data Set dialog.

  3. Click Query Builder to load the query to the Query Builder.


    Note:

    If you have made modifications to the query, or did not use the Query Builder to construct it, you may receive an error when launching the Query Builder to edit it. If the Query Builder cannot parse the query, you can edit the statements directly in the text box.


  4. Edit the query and click Save.

Defining SQL Queries Against the Oracle BI Server

??? add text here

Creating a Data Set Using a MDX Query Against an OLAP Data Source

BI Publisher supports Multidimensional Expressions (MDX) queries against OLAP data sources. MDX lets you query multidimensional objects, such as Essbase cubes, and return multidimensional cellsets that contain the cube's data. You create MDX queries by manually entering the MDX query or by using MDX Query Builder to build the query.

Creating a Data Set Using a MDX Query

To create a data set using a MDX query:

  1. On the toolbar, click New Data Set and then select MDX Query. The New Data Set - MDX Query dialog launches as shown in Figure 13-11.

    Figure 13-11 New Data Set - MDX Query Dialog

    Sample MDX Query
  2. Enter a name for the data set.

  3. Select the data source for the data set. Only the data sources defined as OLAP connections are displayed in the list.

    Any private OLAP data source connections that you created will also be available in the Data Source drop-down list. For more information on creating private data source connections, see Managing Private Data Sources.

  4. Enter the MDX query or click Query Builder. For more information on using MDX Query Builder, see Using MDX Query Builder.

  5. Click OK to save. The data model editor validates the query.


Note:

Ensure that in your OLAP data source that you do not use Unicode characters from the range U+F900 to U+FFFE to define any metadata attributes such as column names or table names. This Unicode range includes half-width Japanese Katakana and full-width ASCII variants. Using these characters results in errors when generating the XML data for a BI Publisher report.


For more information on writing MDX queries, see "Writing MDX Queries" in the Oracle Essbase Database Administrators Guide.

Using MDX Query Builder

Use MDX Query Builder to build MDX basic queries without having to code them. MDX Query Builder enables you to add dimensions to columns, rows, pages, and point of view axes and preview the query results.

Understanding the MDX Query Builder Process

To use MDX Query Builder to build a MDX query:

  1. On the toolbar, click New Data Set and then select MDX Query to launch the New Data Set - MDX Query dialog.

  2. Enter a name for the data set.

  3. Select a data source.

  4. Launch MDX Query Builder.

  5. Select an Essbase cube for the query.

  6. Select dimensions and measures by dragging and dropping them to the Columns, Rows, Slicer/POV, and the Pages axes.

  7. (Optional) Use actions to modify the query.

  8. (Optional) Apply filters.

  9. Set the query options and save the query.

Using the Select Cube Dialog

In the Select Cube dialog, you select the Essbase cube that you want to use to build the MDX query.

The MDX data source connection that you selected previously drives which Essbase cubes are available for selection.

Selecting Dimensions and Measures

You build MDX queries by selecting dimensions for the Columns, Rows, Slicer/POV, and Pages axes.

Account dimension members are listed individually by member name. All other dimension members are represented by generation name as shown in Figure 13-12.

You can drag dimension generations and individual measures from the Account dimension to the Columns, Rows, Slicer/POV, and Pages axes.

Figure 13-12 Dimensions as Displayed in MDX Query Builder

Sample MDX Query

Build the query by dragging dimension members or measures from the Dimensions panel to one of the following axes areas:

  • Columns — Axis (0) of the query

  • Rows — Axis (1) of the query

  • Slicer/POV— The slicer axis enables you to limit a query to only a specific slice of the Essbase cube. This represents the optional WHERE clause of a query.

  • Pages — Axis (2) of the query

You can nest dimension members in the Columns and Rows axes, but you can only add a single dimension to the Slider/POV axis.

Adding Dimension Members to the Slicer/POV Axis

When you add a dimension to the Slicer/POV axis, the Member Selection dialog launches. You can only select one dimension member for this axis. Simply select the dimension in the Member Selection dialog, and click OK.

The Member Selection dialog does not display if you add a measure to the Slicer/POV axis.

Performing MDX Query Actions

The MDX Query Builder toolbar contains the following buttons for modifying the MDX query:

  • Click Swap Rows and Columns to flip dimensions between columns and rows.

  • Click Actions to display the following menu items for selection:

    • Select Cube — Selects a different Essbase cube for the query.

    • Set Alias Table — Selects the alias table used for dimension display names.

    • Auto Refresh — Displays the results as dimension members are placed in the Columns, Rows, Slicer/POV, and Pages axes and automatically refreshes the MDX query syntax.

    • Clear Results — Clears the results and removes member selections from all of the axes and any filters added to the query.

    • Show Empty Columns — Displays columns that do not contain data.

    • Show Empty Rows — Displays rows that do not contain data.

    • Show Query — Displays the MDX query syntax resulting from how the dimensions are placed in the Columns, Rows, Slicer/POV, and Pages axes.

Applying MDX Query Filters

You can create filters for dimensions on the Columns, Rows, and Pages axes in MDX Query Builder to further streamline your MDX query.

To create a filter, click the down-arrow button to the right of a dimension in the Columns, Rows, or Pages axes to display it in the Filters area. You create the filter by selecting the desired dimension member as shown in Figure 13-13.

Figure 13-13 MDX Query Builder Filters

Sample MDX Query

You can create multiple filters for a query, but you can only create one filter for each Columns, Rows, or Pages axis.

Selecting MDX Query Options and Saving MDX Queries

Once you have built the query, click Save to display the Options dialog as shown in Figure 13-14.

Figure 13-14 Options Dialog

Sample MDX Query

Use the Options dialog to select the dimension properties to include in the query for each of the dimensions in the Columns, Rows, and Pages axes. By default, none of the properties are selected.

The dimension properties are as follows:

  • Member Alias — Dimension member alias names as listed in the Essbase outline.

  • Ancestor Names — Ancestor dimension names as listed in the Essbase outline.

  • Level Number — Dimension level numbers as listed in the Essbase outline.

  • Gen Number — Generation number of the dimensions as listed in the Essbase outline.

For example, if you select the Member Alias and Level Number properties for Columns, the MDX query results would be as follows:

SELECT
NON EMPTY Hierarchize([Market].Generations(2).Members)
PROPERTIES MEMBER_ALIAS,LEVEL_NUMBER ON Axis(0),
NON EMPTY CROSSJOIN(Hierarchize([Product].Generations(3).Members),
{[Accounts].[Margin],[Accounts].[Sales],[Accounts].[Total_Expenses]})ON Axis(1),
NON EMPTY [Year].Generations(3).Members ON Axis(2) FROM Demo.Basic

For more information on Essbase dimension properties, see "Querying for Properties" in the Oracle Essbase Database Administrator's Guide.

After you select options for the MDX query, click OK to return to the New Data Set - MDX Query dialog and review the MDX query output as shown in Figure 13-15.

Figure 13-15 MDX Query Output

Sample MDX Query

Click OK to return to the data model editor, and save your changes.


Important:

If you modify a MDX query after you save it in BI Publisher, Oracle recommends that you manually change the syntax and not use MDX Query Builder to do so.


Creating a Data Set Using an LDAP Query

BI Publisher supports queries against Lightweight Directory Access protocol (LDAP) data sources. You can query user information stored in LDAP directories and then use the data model editor to link the user information with data retrieved from other data sources.

For example, to generate a report that lists employee salary information that is stored in the database application and include on the report employee e-mail addresses that are stored in the LDAP directory. You can create a query against each and then link the two in the data model editor to display the information in a single report. Figure 13-16 shows a sample LDAP query.

Figure 13-16 Sample LDAP Query

Sample LDAP Query

To create a data set using an LDAP query:

  1. Click the New Data Set toolbar button and select LDAP. The Create Data Set - LDAP dialog launches.

  2. Enter a name for this data set.

  3. Select the Data Source for this data set. Only data sources defined as LDAP connections display in the list.

  4. In the Attributes entry box, enter the attributes whose values you want to fetch from the LDAP data source.

    For example:

    mail,cn,givenName
    
  5. To filter the query, enter the appropriate syntax in the Filter entry box. The syntax is as follows:

    (Operator (Filter)through(Filter))
    

    For example:

    (objectclass=person)
    

    LDAP search filters are defined in the Internet Engineering Task Force (IETF) Request for Comments document 2254, "The String Representation of LDAP Search Filters," (RFC 2254). This document is available from the IETF Web site at http://www.ietf.org/rfc/rfc2254.txt

  6. Link the data from this query to the data from other queries or modify the output structure. For instructions on completing this step, see Chapter 14, "Structuring Data."

Creating a Data Set Using a Microsoft Excel File

To use a Microsoft Excel file as a data source, you have the following options for providing the file to BI Publisher:

About Supported Excel Files

Following are guidelines for the support of Microsoft Excel files as a data set type in BI Publisher:

  • The Microsoft Excel files must be saved in the Excel 97-2003 Workbook (*.xls) format by Microsoft Excel. Files created by a third party application or library are not supported.

  • The source Excel file might contain a single sheet or multiple sheets.

  • Each worksheet may contain one or multiple tables. A table is a block of data that is located in the continuous rows and columns of a sheet.

    In each table, BI Publisher always considers the first row to be a heading row for the table.

  • The data type of the data in the table may be number, text, or date/time.

  • If multiple tables exist in a single worksheet, the tables must be identified with a name for BI Publisher to recognize each one. See Guidelines for Accessing Multiple Tables per Sheet.

  • If all tables in the Excel file are not named, only the data in the first table (the table located in the upper most left corner) is recognized and fetched.

  • When the data set is created, BI Publisher truncates all trailing zeros after the decimal point for numbers in all cases. To preserve the trailing zeros in your final report, you must apply a format mask in your template to display the zeroes. For more information about format masks, see the section "Number, Date, and Currency Formatting" in Oracle Fusion Middleware Report Designer's Guide for Oracle Business Intelligence Publisher.

  • Single value parameters are supported, but multiple value parameters are not supported.

Guidelines for Accessing Multiple Tables per Sheet

If the Excel worksheet contains multiple tables that you want to include as data sources, then you must define a name for each table in Excel.


Important:

The name that you define must begin with the prefix: "BIP_", for example, "BIP_SALARIES".


To define a name for the table in Excel:

  1. Insert the table in Excel.

  2. Define a name for the table as follows:

    Using Excel 2003: Select the table. On the Insert menu, click Name and then Define. Enter a name that is prefixed with "BIP_".

    Using Excel 2007: Select the table. On the Formulas tab, in the Defined Names group, click Define Name, then enter the name in the Name field. The name you enter appears on the Formula bar.


    Tip:

    You can learn more about defined names and their usage in the Microsoft Excel 2007 document "Define and use names in formulas." at the following URL:

    http://office.microsoft.com/en-us/excel/HA101471201033.aspx


Figure 13-17 shows how to use the Define Name command in Microsoft Excel 2007 to name a table "BIP_Salaries".

Figure 13-17 Using the Define Name Command in MIcrosoft Excel

Using the Define Name command

Using a Microsoft Excel File Stored in a File Directory Data Source

Note that to include parameters for your data set, you must define the parameters first, so that they are available for selection when defining the data set. See Chapter 15, "Adding Parameters and Lists of Values."


Important:

The Excel data set type supports one value per parameter. It does not support multiple selection for parameters.


To create a data set using a Microsoft Excel file from a file directory data source:

  1. Click the New Data Set toolbar button and select Microsoft Excel File. The Create Data Set - Excel dialog launches.

  2. Enter a name for this data set.

  3. Click Shared to enable the Data Source list.

  4. Select the Data Source where the Excel File resides.

  5. Click the browse icon to browse for the Microsoft Excel file in the data source directories. Select the file.

  6. If the Excel file contains multiple sheets or tables, select the appropriate Sheet Name and Table Name for this data set, as shown in Figure 13-18.

    Figure 13-18 Selecting the Sheet Name

    Selecting the sheet name
  7. If you added parameters for this data set, click Add Parameter. Enter the Name and select the Value. The Value list is populated by the parameter Name defined in the Parameters section. Only single value parameters are supported. See Chapter 15, "Adding Parameters and Lists of Values."

  8. Click OK.

  9. Link the data from this query to the data from other queries or modify the output structure. For more information on linking queries, see Chapter 14, "Structuring Data."

Uploading a Microsoft Excel File Stored Locally

Note that to include parameters for the data set, you must define the parameters first, so that they are available for selection when defining the data set. See Chapter 15, "Adding Parameters and Lists of Values."


Important:

The Excel data set type supports one value per parameter. It does not support multiple selection for parameters.


To create a data set using a Microsoft Excel file stored locally:

  1. Click the New Data Set toolbar button and select Microsoft Excel File. The Create Data Set - Excel dialog launches.

  2. Enter a name for this data set.

  3. Select Local to enable the upload button.

  4. Click the Upload icon to browse for and upload the Microsoft Excel file from a local directory. If the file has been uploaded to the data model, then it is available for selection in the File Name list.

  5. If the Excel file contains multiple sheets or tables, select the appropriate Sheet Name and Table Name for this data set, as shown in Figure 13-19.

    Figure 13-19 Defining Excel Spreadsheet for Data Set

    Defining Excel Spreadsheet as data set
  6. If you added parameters for this data set, click Add Parameter. Enter the Name and select the Value. The Value list is populated by the parameter Name defined in the Parameters section. Only single value parameters are supported. See Chapter 15, "Adding Parameters and Lists of Values."

  7. Click OK.

  8. Link the data from this query to the data from other queries or modify the output structure. For more information on linking queries, see Chapter 14, "Structuring Data."

Refreshing and Deleting an Uploaded Excel File

After uploading the file, it displays on the Properties pane of the data model under the Attachments region, as shown in Figure 13-20.

Figure 13-20 Attachments Region of the Properties Pane

Attachments region

See Setting Data Model Properties for information about the Properties pane.

To refresh the local file in the data model:

  1. Click Data Model in the component pane to view the Properties page.

  2. In the Attachment region of the page, locate the file in the Data Files list.

  3. Click Refresh.

  4. In the Upload dialog, browse for and upload the latest version of the file. The file must have the same name or it will not replace the older version.

  5. Save the data model.

To delete the local file:

  1. Click Data Model in the component pane to view the Properties page.

  2. In the Attachment region of the page, locate the file in the Data Files list.

  3. Click Delete.

  4. Click OK to confirm.

  5. Save the data model.

Creating a Data Set Using an Oracle BI Analysis

If you have enabled integration with Oracle Business Intelligence, then you can access the Oracle Business Intelligence Presentation catalog to select an Oracle BI analysis as a data source. An analysis is a query against an organization's data that provides answers to business questions. A query contains the underlying SQL statements that are issued to the Oracle BI Server.

For more information about creating analyses, see Oracle Fusion Middleware User's Guide for Oracle Business Intelligence Publisher.


Important:

Hierarchical columns are not supported in BI Publisher data models.


To create a data set using an Oracle BI analysis:

  1. Click the New Data Set toolbar button and select Oracle BI Analysis. The New Data Set - Oracle BI Analysis dialog launches.

  2. Enter a name for this data set.

  3. Click the browse icon to connect to the Oracle BI Presentation catalog, as shown in Figure 13-21.

    Figure 13-21 Connecting to the Oracle BI Presentation Catalog

    Connect to BI Presentation catalog
  4. When the catalog connection dialog launches, navigate through the folders to select the Oracle BI analysis to use as the data set for the report.

  5. Enter a Time Out value in seconds, as shown in Figure 13-22. If BI Publisher has not received the analysis data after the time specified in the time out value has elapsed, then BI Publisher stops attempting to retrieve the analysis data.

    Figure 13-22 Creating a BI Analysis Data Set

    Creating a BI Analysis data set
  6. Click OK.

Additional Notes on Oracle BI Analysis Data Sets

Parameters and list of values are inherited from the BI analysis and they display at run time.

The BI Analysis must have default values defined for filter variables. If the analysis contains presentation variables with no default values, it is not supported as a data source by BI Publisher.

If you want to structure the data based on Oracle BI Analysis Data Sets, the group breaks, data links and group-level functions are not supported.

The following are supported:

  • Global level functions

  • Setting the value for elements if null

  • Group Filters

For more information about the above supported features, see Chapter 14, "Structuring Data."

Creating a Data Set Using a View Object

BI Publisher enables you to connect to your custom applications built with Oracle Application Development Framework and use view objects in your applications as data sources for reports.

This procedure assumes that you have created a view object in your application. For more information, see the chapter "Making a View Object Available to BI Publisher as a Data Source" in the Oracle Fusion Middleware Developer's Guide for Oracle Business Intelligence Publisher.

To create a data set using a view object:

  1. Click the New Data Set toolbar button and select View Object. The Create Data Set - View Object dialog launches.

  2. Enter a name for this data set.

  3. Select the Data Source from the list. The data sources that you defined in the providers.xml file display.

  4. Enter the fully qualified name of the application module (for example: example.apps.pa.entity.applicationModule.AppModuleAM).

  5. Click Load View Objects.

    BI Publisher calls the application module to load the view object list.

  6. Select the View Object.

  7. Any bind variables defined are retrieved. Create a parameter to map to this bind variable See Chapter 15, "Adding Parameters and Lists of Values."

  8. Click OK to save your data set.

Additional Notes on View Object Data Sets

To structure data based on view object data sets, the group breaks, data links and group-level functions are not supported.

The following is supported: Setting the value for elements if null.

For more information about this supported feature, see Chapter 14, "Structuring Data."

Creating a Data Set Using a Web Service

BI Publisher supports Web service data sources that return valid XML data.


Important:

Additional configuration may be required to access external Web services depending on your system's security. If the WSDL URL is outside the company firewall, then see the section "Configuring Proxy Settings" in Oracle Fusion Middleware Administrator's Guide for Oracle Business Intelligence Publisher.


If the Web service is protected by Secure Sockets Layer (SSL), then see the section "Configuring BI Publisher for Secure Socket Layer Communication" in Oracle Fusion Middleware Administrator's Guide for Oracle Business Intelligence Publisher.

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: Example and Adding a Complex Web Service for descriptions of setting up each type.

Note that 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 Chapter 15, "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. To call a method in the 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 passes one parameter: the quote symbol for a stock.

The WSDL URL is:

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

If you are not familiar with the available methods and parameters in the Web service 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. Click the New Data Set toolbar button and select Web Service. The New Data Set - Web Service dialog launches, as shown in Figure 13-23.

    Figure 13-23 Creating a Simple Web Service Data Set

    Creating a Web Service data set
  2. Enter the Web service name.

  3. Enter the Web service information as follows:

    • Select False for Complex Type.

    • Enter the WSDL URL: http://www.webservicex.net/stockquote.asmx?WSDL

    • Enter the Method: GetQuote

    • If desired, enter a Time Out period in seconds. If the BI Publisher server cannot establish a connection to the Web service, the connection attempt times out after the specified time out period has elapsed.

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

    Select Parameters on the Data Model pane and click the Create New Parameter button. Enter the following:

    • Name — Enter an internal identifier for the parameter (for example, Symbol).

    • Data Type — Select String.

    • Default Value — If desired, enter a default for the parameter (for example, ORCL).

    • Parameter Type — Select Text.

    • Row Placement — Select a row placement value. The default is 1.

  5. In the New_Parameter_1:Type: Text region, enter the following:

    • Display Label — Enter the label you want displayed for your parameter (for example: Stock Symbol).

    • Text Field Size — Enter the size for the text entry field in characters.

      Figure 13-24 Creating the Parameter

      Creating the parameter
  6. Select the options that you want to apply:

    • Text field contains comma-separated values — Select this option to enable the user to enter multiple comma-delimited values for this parameter.

    • Refresh other parameters on change — Performs a partial page refresh to refresh any other parameters whose values are dependent on the value of this one.

  7. Return to your Web service data set and add the parameter as follows:

    • Click the data set name, Stock Quote.

    • On the toolbar, click Edit Selected Data Set to launch the Edit Data Set dialog.

    • In the Edit Data Set dialog, click Add Parameter. The Quote parameter displays, as shown in Figure 13-25.

    • Name the parameter, and click OK to close the Edit Data Set dialog.

    • Figure 13-25 Adding the Parameter to Web Service Data Set

      Adding parameter to Web Service data set
  8. Click Save.

  9. Select the Data tab.

  10. Enter a valid value for your Stock Symbol parameter, select the number of rows to return, and click Get Data. Figure 13-26 shows the data returned from the example.

    Figure 13-26 Data Returned from Stock Quote Example

    Data returned from stock quote example

Adding a Complex Web Service

A complex Web service type internally uses soapRequest / soapEnvelope to pass the parameter values to the destination host.

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 data model editor displays the available Web services and operations. For each selected operation, the data model editor displays the structure of the required input parameters. By choosing Show Optional Parameters, you can see all optional parameters as well.

If you are not familiar with the available methods and parameters in the Web service, open the WSDL URL in a browser to view them.

To add a complex Web service as a data source:

  1. Enter the data set information as follows:

    • Enter a Name for the data set and select Web Service as the Type.

    • Select True for Complex Type.

    • Select a security header as follows:

      • 2002 — Enables the "WS-Security" Username Token with the 2002 namespace:

        http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd

      • 2004 — Enables the "WS-Security" Username Token with the 2004 namespace:

        http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText

    • Username and Password — Enter the username and password for the Web service, if required.

    • If desired, enter a Time Out period in seconds. If the BI Publisher server cannot establish a connection to the Web service, then connection attempt times out after the specified time out period has elapsed.

    • Enter a WSDL URL. When you enter the WSDL, the Web Service list populates with the available Web services from the WSDL.

    • Choose a Web Service from the list. When you choose a Web service from the list, the Method list populates with the available methods.

    • Select the Method. When you select the method, the Parameters display. If you want to see optional parameters as well, then select Show Optional Parameters.

    • Response Data XPath — If the start of the XML data for the report is deeply embedded in the response XML generated by the Web service request, then use this field to specify the path to the data to use in the BI Publisher report.

  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 parameter. Enter the following:

    • Name — Enter an internal identifier for the parameter.

    • Data Type — Select the appropriate data type for the parameter.

    • Default Value — If desired, enter a default value for the parameter.

    • Parameter Type — Select the appropriate parameter type.

    • Display label — Enter the label you want displayed for your parameter.

    • Text Field Size — Enter the size for the text entry field in characters.

  3. Return to the Web Service data set and add the parameter.

    • Select the Web service data set and then click Edit Selected Data Set to launch the Edit Data Set dialog.

    • Select the parameters as shown in Figure 13-27.

    • Figure 13-27 Entering Parameters for Complex Web Service

      Entering parameters for complex Web Service
  4. To test the Web service, see Testing Data Models and Generating Sample Data.

Additional Information on Web Service Data Sets

There is no metadata available from Web Service data sets, therefore grouping and linking are not supported.

Creating a Data Set Using a XML File

To use an XML file as a data source, perform one of the following actions:


Important:

To use BI Publisher's layout editor and interactive viewer, sample data from the XML file source must be saved to the data model.


About Supported XML Files

The following are guidelines for the support of XML files as a data set type in BI Publisher:

  • The XML files that you use as input to the BI Publisher data engine must be UTF-8 encoded.

  • Do not use the following characters in XML tag names: ~, !, #, $, %, ^, &, *, +, `, |, :, \", \\, <, >, ?, ,, /. If your data source file contains any of these characters, use the data model editor Structure tab to change the tag names to an acceptable one.

  • The XML file must be valid. Oracle provides many utilities and methods for validating XML files.

  • There is no metadata available from XML file data sets, therefore grouping and linking are not supported.

Using a XML File Stored in a File Directory Data Source

To create a data set using a XML file from a file directory data source:

  1. On the toolbar, click New Data Set and select XML File. The New Data Set - XML File dialog launches, as shown in Figure 13-28.

    Figure 13-28 New Data Set - XML File Dialog

    Create data set - file dialog
  2. Enter a name for the data set.

  3. Click Shared to enable the Data Source list. This is the default selected option.

  4. Select the Data Source where the XML file resides. The list is populated from the configured File Data Source connections.

  5. To the right of File Name, click Browse to connect to the data source and browse the available directories. Select the file.

  6. Click OK.

  7. (Required) Save sample data to the data model. See Testing Data Models and Generating Sample Data.

Uploading a XML File Stored Locally

To create a data set using a XML file stored locally:

  1. On the toolbar, click New Data Set and select XML File. The New Data Set - XML File dialog launches, as shown in Figure 13-29.

    Figure 13-29 New Data Set - XML File Dialog

    Create data set - file dialog
  2. Enter a name for this data set.

  3. Select Local to enable the Upload button.

  4. Click Upload to browse for and upload the XML file from a local directory. If the file has been uploaded to the data model, then it is available for selection in the File Name List.

  5. Click Upload.

  6. Click OK.

  7. (Required) Save sample data to the data model. See Testing Data Models and Generating Sample Data.

Refreshing and Deleting an Uploaded XML File

After uploading the file, it displays on the Properties pane of the data model under the Attachments region, as shown in Figure 13-30.

Figure 13-30 Attachments Region of the Properties Pane

Attachments region

See Setting Data Model Properties for more information about the Properties pane.

To refresh the local file in the data model:

  1. In the component pane, click Data Model to view the Properties page.

  2. In the Attachment region of the page, locate the file in the Data Files list.

  3. Click Refresh.

  4. In the Upload dialog, browse for and upload the latest version of the file. The file must have the same name or it will not replace the older version.

  5. Save the data model.

To delete the local file:

  1. In the component pane, click Data Model to view the Properties page.

  2. In the Attachment region of the page, locate the file in the Data Files list.

  3. Click Delete.

  4. Click OK to confirm.

  5. Save the data model.

Creating a Data Set Using a CSV File

To use a CSV file as a data source, perform one of the following actions:

About Supported CSV Files

The following are guidelines for the support of CSV files as a data set type in BI Publisher:

  • The following CSV file delimiters are supported: Comma, Pipe, Semicolon, and Tab.

  • If your CSV file contains headers, the header names are used as the XML tag names. The following characters are not supported in XML tag names: ~, !, #, $, %, ^, &, *, +, `, |, :, \", \\, <, >, ?, ,, /. If your data source file contains any of these characters in a header name, use the data model editor Structure tab to edit the tag names.

  • CSV data sets support editing the data type assigned by the data model editor. See Editing the Data Type for more information. If you update the data type for an element in the data set, you must ensure that the data in the file is compliant with the data type that you selected.

  • The CSV files that you use as input to the BI Publisher data engine must be UTF-8 encoded and cannot contain empty column headers.

  • Group breaks, data links, expression and group-level functions are not supported.

  • Data fields in CSV files must be in the canonical ISO date format for mapped date elements, and ######.## for mapped number elements.

Using a CSV File Stored in a File Directory Data Source

To create a data set using a CSV file from a file directory data source:

  1. On the data model editor toolbar, click New Data Set and select CSV File. The New Data Set - CSV File dialog launches, as shown in Figure 13-28.

    Figure 13-31 New Data Set - CSV File Dialog

    Create data set - file dialog
  2. Enter a name for this data set.

  3. Click Shared to enable the Data Source list.

  4. Select the Data Source where the CSV file resides. The list is populated from the configured File Data Source connections.

  5. Click Browse to connect to the data source and browse the available directories. Select the file.

  6. (Optional) Select The first row a column header to specify if the first row in the file contains column names. If you do not select this option, the columns are assigned a generic name, for example, Column1, Column2. The XML tag names and display names assigned can be edited in the data model editor Structure tab.

  7. Select the CSV deliminator used in the file. The default selection is Comma (,).

  8. Click OK.

Uploading a CSV File Stored Locally

To create a data set using a CSV file stored locally:

  1. On the toolbar, click New Data Set and select CSV File. The New Data Set - CSV File dialog launches, as shown in Figure 13-28.

    Figure 13-32 New Data Set - CSV File Dialog

    Create data set - file dialog
  2. Enter a name for this data set.

  3. Select Local to enable the Upload button.

  4. Click Upload to browse for and upload the CSV file from a local directory. If the file has been uploaded to the data model, then it is available for selection in the File Name List.

  5. (Optional) Select The first row a column header to specify if the first row in the file contains column names. If you do not select this option, the columns are assigned a generic name, for example, Column1, Column2. The XML tag names and display names assigned can be edited in the data model editor Structure tab.

  6. Select the CSV Deliminator used in the file. The default selection is Comma (,).

  7. Click OK.

Editing the Data Type

To edit the data type for a CSV file element, click the data type icon or update it from the element Properties dialog.

The data for an element must be compliant with the data type that you assign. The user interface does not validate the data when you update the data type. If the data does not match, for example, a string value is present for an element you defined as Integer, errors may occur in the layout editing tools and or at runtime.

You can only update the data types for CSV file data sources.

Refreshing and Deleting an Uploaded CSV File

After uploading the file, it is displayed on the Properties pane of the data model under the Attachments region, as shown in Figure 13-33.

Figure 13-33 Attachments Region of the Properties Pane

Attachments region

See Setting Data Model Properties for more information about the Properties pane.

To refresh the local file in the data model:

  1. In the component pane, click Data Model to view the Properties page.

  2. In the Attachment region of the page, locate the file in the Data Files list.

  3. Click Refresh.

  4. In the Upload dialog, browse for and upload the latest version of the file. The file must have the same name or it will not replace the older version.

  5. Save the data model.

To delete the local file:

  1. In the component pane, click Data Model to view the Properties page.

  2. In the Attachment region of the page, locate the file in the Data Files list.

  3. Click Delete.

  4. Click OK to confirm.

  5. Save the data model.

Using Data Stored as a Character Large Object (CLOB) in a Data Model

BI Publisher supports using data stored as a character large object (CLOB) data type in your data models. This feature enables you to use XML data generated by a separate process and stored in your database as input to a BI Publisher data model.

Use the Query Builder to retrieve the column in your SQL query, then use the data model editor to specify how you want the data structured. When the data model is executed, the data engine can structure the data either as:

To create a data set from data stored as a CLOB:

  1. On the toolbar, click New Data Set and then select SQL Query. The New Data Set - SQL Query dialog launches.

  2. Enter a name for the data set.

  3. If you are not using the default data source for this data set, select the Data Source from the list.

  4. Enter the SQL query or use the Query Builder to construct your query to retrieve the CLOB data column. See Using the SQL Query Builder for information on the Query Builder utility. Figure 13-34 shows an example query in which the CLOB data is stored in a column named "DESCRIPTION".

    Figure 13-34 Sample Query

    Sample query
  5. After entering the query, click OK to save. BI Publisher validates the query.

  6. By default, the data model editor assigns the CLOB column the "CLOB" data type. To change the data type to XML, click the data type icon and select XML, as shown in Figure 13-35.

    Figure 13-35 Changing the Data Type to XML

    Changing the data type to XML

How the Data Is Returned

When you execute the query, if the CLOB column contains well-formed XML, and you select the XML data type, the data engine returns the XML data, structured within the CLOB column tag name.

Example output when data type is XML:

Note the <DESCRIPTION> element contains the XML data stored in the CLOB column, as shown in Figure 13-36.

Figure 13-36 Example Data Structure When the Data Type is XML

Example Output When the Data Type is XML

Example output when data type is CLOB

If you select to return the data as the CLOB data type, the returned data is structured as shown in Figure 13-37.

Figure 13-37 Example Data Structure When Data Type Is CLOB

Example data structure when data type is CLOB

Additional Notes on Data Sets Using CLOB Column Data

For specific notes on using CLOB column data in a bursting query, see Adding a Bursting Definition to Your Data Model.

Handling XHTML Data Stored in a CLOB Column

BI Publisher can retrieve data stored in the form of XHTML documents stored in a database CLOB column and render the markup in the generated report. To enable the BI Publisher report rendering engine to handle the markup tags, you must wrap the XHTML data in a CDATA section within the XML report data that is passed by the data engine.

It is recommended that you store the data in the database wrapped with the CDATA section. You can then use a simple select statement to extract the data. If the data is not wrapped in the CDATA section, then you must include in your SQL statement instructions to wrap it.

The following sections describe how to extract XHTML data in each case:

To display the markup in a report, you must use the syntax described in "Rendering HTML Formatted Data in a Report" in the Oracle Fusion Middleware Report Designer's Guide for Oracle Business Intelligence Publisher. This section also describes the supported HTML formats. Rendering the HTML markup in a report is supported for RTF templates only.

Retrieving XHTML Data Wrapped in CDATA

Assume you have the following data stored in a database column called "CLOB_DATA":

<![CDATA[
<p><font style="font-style: italic; font-weight: bold;" size="3">
<a href="http://www.oracle.com">oracle</a></font> </p>
<p><font size="6"><a href="http://docs.oracle.com/">Oracle Documentation</a>
</font></p>
]]>

Retrieve the column data using a simple SQL statement, for example:

select CLOB_DATA as "RTECODE"  from MYTABLE 

In the data model editor, set the data type of the RTECODE column to XML, as shown in Figure 13-38.

Figure 13-38 Set Data Type to XML

Set data type to XML

Wrapping the XHTML Data in CDATA in the Query

Assume you have the following data stored in a database column called "CLOB_DATA":

<p><font style="font-style: italic; font-weight: bold;" size="3">
<a href="http://www.oracle.com">oracle</a></font> </p>
<p><font size="6"><a href="http://docs.oracle.com/">Oracle Documentation</a>
</font></p>

Use the following syntax in your SQL query to retrieve it and wrap it in the CDATA section:

select '<![CDATA' || '['|| CLOB_DATA || ']' || ']>' as "RTECODE"from MYTABLE

In the data model editor, set the data type of the RTECODE column to XML, as shown in Figure 13-38.

Creating a Data Set from an HTTP XML Feed

Using the HTTP (XML Feed) data set type you can create data models from RSS and XML feeds over the Web by retrieving data through the HTTP GET method.


Important:

Additional configuration might be required to access external data source feeds depending on your system's security. If the RSS feed is protected by Secure Sockets Layer (SSL) then see the section "Configuring BI Publisher for Secure Sockets Layer Communication" in Oracle Fusion Middleware Administrator's Guide for Oracle Business Intelligence Publisher.


Note that to include parameters for the data set, you must define the parameters first, so that they are available for selection when defining the data set. See Chapter 15, "Adding Parameters and Lists of Values."

To create a data set from an HTTP XML feed:

  1. On the toolbar, click New Data Set and select HTTP (XML Feed). The New Data Set - HTTP (XML Feed) dialog launches, as shown in Figure 13-39.

    Figure 13-39 New Data Set - HTTP (XML Feed) Dialog

    Create data set - HTTP dialog
  2. Enter a name for this data set.

  3. Enter the URL for the source of the RSS or XML feed.

  4. Select the Method: GET.

  5. Enter the Username, Password, and Realm for the URL, if required.

  6. To add a parameter, click Add Parameter. Enter the Name and select the Value. The Value list is populated by the parameter Name defined in the Parameters section. See Chapter 15, "Adding Parameters and Lists of Values."

  7. Click OK to close the data set dialog.

Additional Information on Data Sets Created from HTTP XML Feed

There is no metadata available from HTTP XML feed data sets, therefore grouping and linking are not supported.

Creating a Data Set from an Oracle Endeca Query

Oracle Endeca Information Discovery is an enterprise data discovery platform for advanced exploration and analysis of complex and varied data. Information is loaded from disparate source systems and stored in a faceted data model that dynamically supports changing data. BI Publisher enables Oracle Endeca Information Discovery users to define Endeca Query Language (EQL) queries against the Oracle Endeca Server to retrieve data back to BI Publisher for use in enterprise reporting.

Prerequisite: An administrator must configure the integration with Oracle Endeca Server. For more information, see "Configuring Integration with Oracle Endeca Server" in Oracle Fusion Middleware Administrator's Guide for Oracle Business Intelligence Publisher.

See the Oracle Endeca Server Query Language Reference for information about writing EQL queries. Figure 13-40 shows a sample Oracle Endeca query.

Figure 13-40 Sample Oracle Endeca Query ???Update with data???

Sample Endeca query data set

To create a data set using an EQL query against an Oracle Endeca Server data source:

  1. Click the New Data Set toolbar button and select Oracle Endeca Query. The New Data Set - Oracle Endeca Query dialog launches.

  2. Enter a name for this data set.

  3. Select the Data Store for this data set.

  4. Enter the EQL query by direct entry or by copying and pasting from another source such as an Oracle Endeca Information Discovery view.

  5. Click OK.

Additional Notes on Oracle Endeca Query Data Sets

For data sets retrieved from the Oracle Endeca Server, group breaks, data links and group-level functions are not supported.

The following are supported:

  • Global level functions

  • Setting the value for elements if null

  • Group Filters

For more information about the above supported features, see Chapter 14, "Structuring Data."

Testing Data Models and Generating Sample Data

The data model editor enables you to test your data model and view the output to ensure your results are as expected. After running a successful test, you can choose to save the test output as sample data for your data model. You can also use the Export feature to export sample data to a file. If your data model fails to run, you can view the data engine log.

To test your data model:

  1. In the data model editor, select the Data tab, as shown in Figure 13-41.

    Figure 13-41 Select the Data Model Editor Data Tab

    Get XML Output Button
  2. For SQL Query, Oracle BI Analysis, View Object, and Oracle Endeca Query data sets: On the Data tab, select the number of rows to return. If you included parameters, enter the desired values for the test.

    Figure 13-42 Select the Number of Rows to Return

    Select the Number of Rows to Return
  3. Click View to display the XML that is returned by the data model.

  4. Select one of the following options to display the sample data:

    • Use Tree View to view the sample data in a data hierarchy. This is the default display option.

    • Use Table View to view the sample data in a formatted table like you see in BI Publisher reports.

To save the test data set as sample data for the data model:

  1. After the data model has successfully run, click Save as Sample Data, as shown in Figure 13-43. The sample data is saved to the data model. See Attachments to the Data Model for more information.

    Figure 13-43 Save as Sample Data

    Save as Sample Data

To export the test data:

  1. For SQL Query, Oracle BI Analysis, View Object, and Oracle Endeca Query data sets: On the Data tab, select the number of rows to return.

  2. After the data model has successfully run, click Export. You are prompted to open or save the file to a local directory.

To view the data engine log:

  1. Click View Data Engine Log. You are prompted to open or save the file to a local directory. The data engine log file is an XML file.

Including User Information Stored in System Variables in Your Report Data

BI Publisher stores information about the current user that can be accessed by your report data model. The user information is stored in system variables as described in Table 13-2.

Table 13-2 User Information Stored in Variables

System Variable Description

xdo_user_name

User ID of the user submitting the report. For example: Administrator

xdo_user_roles

Roles assigned to the user submitting the report. For example: XMLP_ADMIN, XMLP_SCHEDULER

xdo_user_report_oracle_lang

Report language from the user's account preferences. For example: ZHS

xdo_user_report_locale

Report locale from the user's account preferences. For example: en-US

xdo_user_ui_oracle_lang

User interface language from the user's account preferences. For example: US

xdo_user_ui_locale

User interface locale from the user's account preferences. For example: en-US


Adding the User System Variables as Elements

To add the user information to the data model, you can define the variables as parameters and then define the parameter value as an element in your data model. Or, you can simply add the variables as parameters then reference the parameter values in your report.

The following query:

select
:xdo_user_name as USER_ID,
:xdo_user_roles as USER_ROLES,
:xdo_user_report_oracle_lang as REPORT_LANGUAGE,
:xdo_user_report_locale as REPORT_LOCALE,
:xdo_user_ui_oracle_lang as UI_LANGUAGE,
:xdo_user_ui_locale as UI_LOCALE
from dual

returns the following results:

<?xml version="1.0" encoding="UTF-8"?>
<! - Generated by Oracle BI Publisher - >
<DATA_DS>
<G_1>
<USER_ROLES>XMLP_TEMPLATE_DESIGNER, XMLP_DEVELOPER, XMLP_ANALYZER_EXCEL, XMLP_ADMIN, XMLP_ANALYZER_ONLINE, XMLP_SCHEDULER </USER_ROLES>
<REPORT_LANGUAGE>US</REPORT_LANGUAGE>
<REPORT_LOCALE>en_US</REPORT_LOCALE>
<UI_LANGUAGE>US</UI_LANGUAGE>
<UI_LOCALE>en_US</UI_LOCALE>
<USER_ID>administrator</USER_ID>
</G_1>
</DATA_DS>

Sample Use Case: Limit the Returned Data Set by User ID

The following example limits the data returned by the user ID:

selectthroughEMPLOYEES.LAST_NAME as LAST_NAME,
  EMPLOYEES.PHONE_NUMBER as PHONE_NUMBER,
  EMPLOYEES.HIRE_DATE as HIRE_DATE,
 :xdo_user_name as USERID 
from   HR.EMPLOYEES EMPLOYEES
where lower(EMPLOYEES.LAST_NAME) = :xdo_user_name

Notice the use of the lower() function, the xdo_user_name is always be in lowercase format. BI Publisher does not have a USERID so you must use the user name and either use it directly in the query; or alternatively you could query against a lookup table to find a user id.

Creating Bind Variables from LDAP User Attribute Values

To bind user attribute values stored in your LDAP directory to a data query you can define the attribute names to BI Publisher to create the bind variables required.

Prerequisite

The attributes that can be used to create bind variables must be defined in the Security Configuration page by an administrator. The attributes are defined in the Attribute Names for Data Query Bind Variables field of the LDAP Security Model definition. See the section "Configuring BI Publisher to Recognize the LDAP Server" in Oracle Fusion Middleware Administrator's Guide for Oracle Business Intelligence Publisher for information about this field. Any attribute defined for users can be used (for example: memberOf, sAMAccountName, primaryGroupID, mail).

How BI Publisher Constructs the Bind Variable

You can reference the attribute names that you enter in the Attribute Names for Data Query Bind Variables field of the LDAP Security Model definition in the query as follows:

xdo_<attribute name>

Assume that you have entered the sample attributes: memberOf, sAMAccountName, primaryGroupID, mail. These can then be used in a query as the following bind variables:

xdo_memberof
xdo_SAMACCOUNTNAME
xdo_primaryGroupID
xdo_mail

Note that the case of the attribute is ignored; however, the "xdo_" prefix must be lowercase.

Use these in a data model as follows:

SELECT
:xdo_user_name AS USER_NAME ,
:xdo_user_roles AS USER_ROLES,
:xdo_user_ui_oracle_lang AS USER_UI_LANG,
:xdo_user_report_oracle_lang AS USER_REPORT_LANG,
:xdo_user_ui_locale AS USER_UI_LOCALE,
:xdo_user_report_locale AS USER_REPORT_LOCALE,
:xdo_SAMACCOUNTNAME AS SAMACCOUNTNAME,
:xdo_memberof as MEMBER_OF,
:xdo_primaryGroupID as PRIMARY_GROUP_ID,
:xdo_mail as MAIL
FROM DUAL

The LDAP bind variables return the values stored in the LDAP directory for the user that is logged in.