4 Adding Parameters and Lists of Values

This topic describes how to add parameters and lists of values to a data model.

About Parameters

Adding parameters to a data model enables users to interact with data when they view reports.

Oracle BI Publisher supports the following parameter types:

  • Text - Enables entering a text string to pass as the parameter.

  • Menu - Enables making selections from a list of values. A list of values can contain fixed data that you specify or a list created using a SQL query that is executed against any of the defined data sources. This option supports multiple selection, a Select All option, and partial page refresh for cascading parameters.

    To create a menu type parameter, define the list of values, and then define the parameter and associate it to the list of values. See Adding Lists of Values.

  • Date - Enables the user to select a date as a parameter. You must use the data type Date and the Java date format.

After defining the parameters in the data model, you can configure how the parameters are displayed in the report as a report-level setting. See Configuring Parameter Settings for the Report in Report Designer's Guide for Oracle Business Intelligence Publisher.

Support for parameters varies based on the data set type. SQL Query data sets support the full set of available parameter features. Other types of data sets might support all, none, or a subset of these features. The table below summarizes the support for each data set type.

Data Set Type Parameter Support Multiple Selection Can Select All Refresh Other Parameters on Change

SQL Query

Yes

Yes

Yes

Yes

MDX Query

No

No

No

No

Oracle BI Analysis

Inherited from Oracle BI Analysis

Yes (using Oracle BI Dashboards)

Yes (using Oracle BI Dashboards)

Yes (using Oracle BI Dashboards)

View Object

Yes, provided that the view object supports and is designed for it

No

No

Yes (view object parameters only)

Web Service

Yes

No

No

No

LDAP Query

Yes

No

No

No

XML File

No

No

No

No

Microsoft Excel File

Yes

No

No

No

CSV File

No

No

No

No

HTTP (XML Feed)

Yes

No

No

No

Adding a New Parameter

Create a new parameter by assigning it a name and other properties.

The parameter name you choose must not exceed the maximum length allowed for an identifier by your database. Refer to your database documentation for identifier length limitations.

Supported types are:

Default parameter values are also used to preview the report output when you design report layouts using Oracle BI Publisher Layout Editor.

BI Publisher supports parameters that are of type text entry or menu (list of values) but not both. You cannot define a combination parameter that enables a user to enter a text value or choose from a menu list of values.

You can configure row placement at the report level. The report definition supports additional display options for parameters. See Configuring Parameter Settings for the Report in Report Designer's Guide for Oracle Business Intelligence Publisher.

  1. On the Data Model components pane, click Parameters and then click Create new Parameter.
  2. Enter a Name for the parameter.
    The name must match any references to this parameter in the data set.
  3. Select the Data Type from the list. A Date data type only supports a Date Parameter Type.
  4. Enter a Default Value for the parameter. This is recommended to prevent long running queries.
  5. Select the Parameter Type.
  6. In the Row Placement setting configure the number of rows for displaying the parameters and in which row to place each parameter.

    For example, if your report has six parameters, you can assign each parameter to a separate row, 1 - 6, with one being the top row; or, you can assign two parameters each to rows 1, 2, 3. By default, all parameters are assigned to row 1.

Creating a Text Parameter

The Text type parameter provides a text box to prompt the user to enter a text entry to pass as the parameter to the data source.

  1. Select Text from the Parameter Type list.
  2. Enter the Display Label. For example, Department.
  3. Enter the Text Field Size as an integer. This field determines the size (width) of the field, but does not limit the number of characters that the user can enter into the text box.
  4. Enable the following Options if required:
    • Text field contains comma-separated values - Enables the user to enter multiple comma-delimited values for this parameter. The parameter in your data source must be defined to support multiple values.

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

The figure below shows how the Department parameter displays to the report consumer.

Creating a Menu Parameter

A Menu type parameter presents a list of values to the user.

You must define the list of values first. See Adding Lists of Values. The Menu type parameter supports the data types of String and Integer only.

The Menu parameter definition includes various options, as shown in the figure below.

  1. Select Menu from the Parameter Type list. The lower pane displays the appropriate fields.
  2. In Data Type, select String or Integer.
  3. Enter the Display Label. The display label is the label that displays to users when they view the report. For example: Department.
  4. Enter the Number of Values to Display in List. If the number of values in the list exceeds the entry in this field, the user must click Search to find a value not displayed, as shown in the figure below. This field defaults to 100.
  5. Select the List of Values that you defined for this parameter.
  6. Enable the following Options if required:
    • Multiple Selection - Allows the user to select multiple entries from the list. Your data source must be able to support multiple values for the parameter. The display of a menu parameter that supports multiple selection differs. See the two figures below.

    • Can select all - Inserts an All option in the list.

      When the user selects All from the list of values, you have the option of passing a null value for the parameter or all list values. Choose NULL Value Passed or All Values Passed.

      Note:

      Using * passes a null, so you must handle the null in your data source. A method to handle the null would be the standard Oracle NVL command, for example:

      where customer_id = nvl(:cstid, customer_id)

      where cstid is a value passed from the list of values, and when the user selects All it passes a null value.

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

The figure below shows how the Department menu type parameter displays to the report consumer when multiple selection is not enabled.

The figure below shows how the Department menu type parameter displays to the report consumer when multiple selection is enabled.

Customizing the Display of Menu Parameters

The display of menu parameters in the report can be further customized in the report definition.

Menu type parameters support the additional display option as a static list of checkboxes or radio buttons. See Configuring Parameter Settings for the Report in Report Designer's Guide for Oracle Business Intelligence Publisher.

Defining a Date Parameter

The Date type parameter provides a date picker to prompt the user to enter a date to pass as the parameter to the data source.

  1. Select Date from the Parameter Type list. The lower pane displays the appropriate fields for your selection.
  2. Enter the Display Label. The display label is the label that displays to users when they view the report. For example: Hire Date.
  3. Enter the Text Field Size as an integer. This field determines the number of characters that the user can enter into the text box for the date entry. For example: 10.
  4. Enter the Date Format String. The format must be a Java date format, for example, MM-dd-yyyy.
  5. Optionally, enter a Date From and Date To. The dates entered here define the date range that are presented to the user by the date picker. For example if you enter the Date From as 01-01-1990, the date picker does not allow the user to select a date before 01-01-1990. Leave the Date To blank to enable all future dates.

The figure shows how the Hire Date parameter displays to the report consumer.

About Lists of Values

A list of values is a defined set of values that a report consumer can select from to pass a parameter value to your data source.

If you define a menu type parameter, the list of values provides the menu of choices. You must define the list of values before you define the menu parameter.

Populate the list using one of the following methods:

  • Fixed Data

    Manually enter the list of values.

  • SQL Query

    Retrieves the values from a database using a SQL query.

  • Flexfield

    Retrieves the values from a key flexfield defined in Oracle E-Business Suite. The flexfield option is only available when Oracle BI Publisher is using the Oracle E-Business Suite security model, see Adding Flexfield Parameters.

Adding Lists of Values

You can create lists of SQL Query or Fixed Data values .

  1. In the Data Model components pane, click List of Values and then click Create new List of Values.
  2. Enter a Name for the list and select a Type.

Creating a List from a SQL Query

The data engine expects a (display) name-value pair from the list of values query. In the list of values select statement, the column listed first is used as the display name and the second is used for the value that is passed to the parameter in the data set query by the data engine.

If the query returns only one column, then the same column value is used both as the list of values display name shown to the user and as the value that is passed to the parameter.

  1. Select a Data Source from the list.
  2. In the lower pane, select Cache Result (recommended) if you want the results of the query cached for the report session.
  3. Enter the SQL query or use the Query Builder. See Using the SQL Query Builder for information on the Query Builder utility. The figure below shows a SQL query type list of values.

The SQL query shown below selects only the DEPARTMENT_NAME column from the DEPARTMENTS table. In this case the list of values both displays the results of the query in the list and passes the same value to the parameter in the data set. The figure below shows the list of values display entries and the values passed to the data set. The menu items and the values shown for P_DEPT are the DEPARTMENT_NAME values.

If instead you wanted to pass the DEPARTMENT_ID to the parameter in the data set, and display the DEPARTMENT_NAME in the list, construct your SQL query as follows:

Select        "DEPARTMENTS"."DEPARTMENT_NAME" as "DEPARTMENT_NAME",
         "DEPARTMENTS"."DEPARTMENT_ID" as "DEPARTMENT_ID"
 from    "DEMO"."DEPARTMENTS" "DEPARTMENTS

The figure below shows the list of values display entries and the values passed to the data set. The menu lists the DEPARTMENT_NAME while the values shown for P_DEPT are the DEPARTMENT_ID values.

Creating a List from a Fixed Data Set

Create a list from a fixed data set for each label-value pair required.

When you create a label-value pair, the label is displayed to the user in the list. The value is passed to the data engine.

  1. In the lower pane, click the Create new List of Values icon to add a Label and Value pair.
  2. Repeat for each label-value pair required.

The figure below shows fixed data type list of values.

Adding Flexfield Parameters

Oracle E-Business Suite customers who have configured BI Publisher to use E-Business Suite security can create reports that leverage key flexfields as parameters.

When you define a data model to pass a key flexfield as a parameter, BI Publisher presents a dialog to the report consumer to make selections for the flexfield segments to pass as parameters to the report, similar to the way flexfields are presented when running reports through the concurrent manager in the E-Business Suite.

The flexfield list of values displays in the report viewer as shown below.

The flexfield list of values displays as a dialog from which you select the segment values, as shown below.

Prerequisites for Using Flexfields

When defining a list of values, E-Business Suite customers see a list Type called "Flexfield".

To enable the flexfield type list of values, BI Publisher must be configured to use E-Business Suite Security. The flexfield must already be defined in the E-Business Suite.

See Oracle E-Business Suite Flexfields Guide and Integrating with Oracle E-Business Suite in Administrator's Guide for Oracle Business Intelligence Publisher.

Adding a Flexfield Parameter and List of Values

Add flexfield parameters by adding the list of values.

The flexfield type list of values retrieves the flexfield metadata definition to present the appropriate values for each segment in the flexfield list of values selection dialog. Use the flexfield parameter to pass values to the Flexfield defined in the Data Model.

At runtime the &flexfield_name reference is replaced with the lexical code constructed based on the values in the Flexfield component definition.

  1. Add the flexfield list of values (LOV).
  2. Add a parameter and associate it with the flexfield LOV by selecting your flexfield list of values as the source menu for the parameter.
  3. Add the Flexfield component to the data model.
  4. Reference the Flexfield in your SQL query using the &flexfield_name syntax.

Adding the Flexfield List of Values

Add a list of values retrieved from a flexfield definition.

When you choose Flexfields as the Type, the Data Source option is no longer editable. All flexfields type lists of values use the Oracle E-Business Suite as the data source.

  1. On the Data Model components pane, click List of Values and then click Create new List of Values.
  2. Enter a Name for the list and choose Flexfields as the Type.
  3. In the Flex_Acct_List:Flexfields pane, enter the following:
    • Application Short Name - E-Business Suite application short name, for example: SQLGL.

    • ID Flex Code - Flexfield code defined for this flexfield in the Register Key Flexfield form, for example: GL#.

    • ID Flex Number - Name of the source column or parameter that contains the flexfield structure information, for example: 101 or :STRUCT_NUM. If you use a parameter, ensure that you define the parameter in the data model.

    The image shows a sample flexfield type, LOV.

Adding the Menu Parameter for the Flexfield List of Values

Define the parameter to display the flexfield list of values and capture the values selected by the user.

The Flexfield type parameter definition includes an additional field called Range to support range flexfields. A range flexfield supports low and high values for each key segment rather than just single values. You can customize the default value of the flexfield and row placement in the report definition. The row placement determines where this parameter appears in the report viewer. To pass a range of flexfield segment values, see Passing a Range of Values

The following options are disabled for flexfield parameters: Number of Values to Display in List, Multiple Selection, Can select all, and Refresh other parameters on change.

  1. On the Data Model components pane, click Parameters and then click Create new Parameter.
  2. Select Menu from the Parameter Type list.
  3. Choose String or Integer as the Data Type.
  4. Enter a Default Value for the flexfield parameter.
  5. Enter the Row Placement.
  6. Enter the Display Label. The display label is the label that displays to users when they view the report. For example: Account From.
  7. Select the List of Values that you defined for this parameter.
    When you select a list of values that is the Flexfield type, an additional field labeled Range displays.

The image shows a parameter definition for the flexfield list of values.

Using the Flexfield Parameter to Pass Values to a Flexfield Defined in the Data Model

After adding the Menu parameter to the flexfield list of values, you can pass the parameter values to a flexfield component in the data model.

Adding Flexfields covers adding a flexfield component in detail. The simplified procedure is provided here to complete the example.

To define the Flexfield in the data model:
  1. On the Data Model components pane, click Flexfields and then click Create new Flexfield.
  2. Enter the following:
    • Name — Enter a name for the flexfield component.

    • Type — Select the flexfield type from the list. The type you select here determines the additional fields required. See Entering Flexfield Details.

    • Application Short Name — Enter the short name of the Oracle Application that owns this flexfield (for example, GL).

    • ID Flex Code — Enter the flexfield code defined for this flexfield in the Register Key Flexfield form (for example, GL#).

    • ID Flex Number — Enter the name of the source column or parameter that contains the flexfield structure information. For example: 101. To use a parameter, prefix the parameter name with a colon, for example, :PARAM_STRUCT_NUM.

  3. In the lower region of the page, enter the details for the type of flexfield you selected. For the field that is to take the parameter value, enter the parameter name prefixed with a colon, for example, :P_Acct_List.

    In the figure below the Flexfield component is defined as a "Where" Type. The parameter :P_Acct_List is entered in the Operand1 field. At runtime, values selected by the user for the parameter P_Acct_List will be used to create the where clause.

Referencing the Flexfield in the SQL Query

Finally, create the SQL query against the E-Business Suite database.

Use the lexical syntax in the query as described in Adding Key Flexfields. In the figure below &Acct_Flex is the Flexfield lexical called in the where condition of the SQL query.

Passing a Range of Values

To define the parameters for the flexfield lists of values when you want to pass a range of values you create two menu parameters that both reference the same flexfield LOV.

At runtime users choose a high value from the list of values and a low value from the same list of values. These two values are then passed as operands to the flexfield component of the data model.

  1. Create one flexfield LOV as described in Adding the Flexfield List of Values.
  2. Create the high range parameter following the steps in Adding the Menu Parameter for the Flexfield List of Values. For the Range field, select High to designate this parameter as the high value.
  3. Create the low range parameter following the steps in Adding the Menu Parameter for the Flexfield List of Values. For the Range field, select Low to designate this parameter as the low value. Both parameters reference the flexfield list of values that you created in Step 1. The figure below shows creating the parameters to define the range.
  4. Create the Flexfield in the data model, as described in Using the Flexfield Parameter to Pass Values to a Flexfield Defined in the Data Model.

    In the lower region of the page, enter the details for the type of flexfield you selected. Enter the parameter prefixed with a colon for example, :P_Acct_List.

    In the figure below the Flexfield component is defined as a "Where" Type. The parameters :P_FLEX_LOW and :P_FLEX_HIGH are entered in the Operand1 and Operand2 fields. At runtime, values selected by the user for the parameters P_FLEX_LOW and P_FLEX_HIGH will be used to create the where clause.

When the report associated with this data model is displayed in the report viewer, the report consumer sees the two flexfield parameters as shown below.

When the report consumer clicks either the high or low flexfield indicator (...), a dialog launches enabling input of both the high and low values as shown below.

The display characteristics in the report viewer of the range flexfield parameter resemble closely the presentation of range flexfields in the E-Business Suite.