Before you Begin
This tutorial shows you how to use parameters with data actions in Oracle Analytics.
Background
You can use parameters with data actions to pass values from a source workbook to a target workbook. The source workbook contains summary data about customers and order priority by city. The target workbook contains detailed information about customers by order priority and city.
What Do You Need?
- Access to Oracle Analytics
- Download sample_order_lines.xlsx to your computer
Create a Dataset
In this section, you create a dataset using the sample_order_lines.xlsx file.
- Sign in to Oracle Analytics.
- On the Home page, click Create, and then click Dataset.
- In Create Dataset, click Drop data file here or click to browse.
- In Create Dataset Table from sample_order_lines.xlsx, click OK.
- Click Save . In Save Dataset As, enter
sample_order_lines
, and then click OK.
Create the Source Workbook
In this section, you create a source workbook containing the data action that passes a parameter value to a target workbook. You also create a calculation for the number of customers.
- Click Create Workbook.
- In the Data panel, right-click My Calculations and click Create Calculation.
- In New Calculation, enter
# of Customers
in Name. In the expression field, enterCount
, select CountDistinct. In column, enterCust
and select Customer Name. - Click Validate. Click Save.
You use in the # of customers and # of orders in the workbook's visualizations just like other data elements in the dataset.
- Click Save . In Save Workbook, enter
Order Priority Summary
, and then click Save.
Create a Parameter in the Source Workbook
In this section, you use the Developer options to capture the Logical SQL statement to help in creating a City parameter.
- In the Data panel, select City, and then drag it to the canvas.
- Click the workbook's Menu , select Developer.
- In the Developer pane, click Logical SQL in the Performance Tools tab. Click Refresh.
- In the Logical SQL tab, copy the SELECT statement for City. Close the Developer pane.
- Click Parameters . Click Add . In Create Parameter, enter
City
in Name. - Click Text in the Data Type row and select Integer.
- Select Logical SQL from Possible Values.
- In the expression field, paste the SELECT statement that you copied from the Logical SQL tab.
Create this filter to act as though all values are selected in the parameter when no values are selected.
Your Logical SQL should look similar to the following with your credentials rather than Admin as seen in this example:
SELECT XSA('Admin'.'sample_order_lines')."sample_order_lines2"."City" s_1 FROM XSA('Admin'.'sample_order_lines') ORDER BY 2 ASC NULLS LAST FETCH FIRST 125001 ROWS ONLY
- Click OK.
The City parameter appears in the Parameter list.
- In the City table visualization, click Menu , and then select Delete Visualization.
Create Visualizations in the Source Workbook
- In the Data panel, hold down the Ctrl key, select Order Priority and select # of Customers from My Calculations. Right-click, select Pick Visualization, and then select Donut .
- Click the visualization's Menu , select Edit, and then select Duplicate Visualization.
- In the second visualization, click Visualization Type , and then select Table .
- Drag City to Rows in the Grammar pane as the first data element.
- Click Table in the Visualization Type list and select Pivot .
- Drag Order Priority from Color to Columns in the Grammar pane.
- Click Save.
Define a Filter Expression
In this section, you define a filter expression with the City parameter and use it in a Dashboard Filter Control.
- Click Visualizations . In the Visualizations pane, drag Dashboard Filters to the canvas.
- Click Data . From the sample_order_lines dataset, drag City to Filter Controls.
- Hover over Filters in the Grammar pane, click Drop Target Options, and then select Create Expression Filter.
Use uppercase for '~ALL~' in the expression.
- In Expression Filter, enter
City
in Label.You must enter the expression. You cannot copy this code to produce a valid expression.
- In the Expression field, enter the expression as follows:
- Enter
CASE
. Delete the default text. - Enter
WHEN '~All~' IN (
- Click Parameters and drag the City parameter to the expression after the opening parenthesis
- Enter
('~All~')
in default value and enter a closing parenthesis - Enter
THEN 1 ELSE (CASE WHEN
- Enter
Cit
, select City from the dataset, enterIN
- Drag the City parameter to the expression
- Enter
('~All~')
in default value, and then enter a closing parenthesis - Enter
THEN 1 ELSE 0 END) END = 1
Your expression should look similar to the following:
CASE WHEN '~All~' IN (@parameter ("City") ('~All~')) THEN 1 ELSE (CASE WHEN City in (@parameter ("City") ('~All~')) THEN 1 ELSE 0 END) END = 1
- Enter
- Click Validate. Click Apply, and click Save.
- In the Dashboard Filter, select Adelaide to update the data in the visualizations.
- Click Save . Click Go back .
Create a Target Workbook
In this section, you create the workbook and visualization to receive the parameter values from the source workbook.
- On the Home page, hover over the sample_order_lines dataset, click Actions, and then select Create Workbook. Close the Insights pane.
- In the Data pane, hold down the Ctrl key, select Order Priority, Customer Name, City, and Sales. Right-click, select Pick Visualization, and then select Pivot .
- Click Visualizations .
- In the Visualizations pane, drag Dashboard Filters to the canvas.
- Click the Data pane. Drag Order Priority to the dashboard filters visualization.
- In the Data pane, drag City to the dashboard filters visualization.
- Click list in the City filter to open the dialog. Click Bind to Parameter . Click Create Parameter and select City.
The Bind to Parameter changes to green from black.
- Click Save . In Save Workbook, enter
Detailed Report
in Name, and then click Save. Click Go back .
Define the Data Action in the Source Workbook
In this section, you create a data action in the Order Priority Summary workbook to pass values to the Detailed Report workbook.
- On the Home page, hover over the Order Priority Summary workbook, click Actions , and then click Open.
- Click Edit .
- Click the workbook Menu and select Data Actions.
- In Data Actions, click Create Action .
- Enter
City by Sales and Order Priority
in Name. Select Analytics Link from the Type list. - Click Select Data in Anchor To, and click Order Priority. Click outside the selection list.
- In Target, click This Workbook, and then click Select from Catalog.
- In Select a workbook, click Detailed Report, and then click OK. Leave the value, All, in Pass Values and Pass Parameter Values. Click OK.
- Click Save .
Test the Analytics Link
In this section, you select a city from the dashboard filter control, select an order priority value in the donut visualization, and then test the data action link in the source workbook.
- In the dashboard filter visualization, select Adelaide from the City list.
If the value in City is Adelaide already, go to step 2.
- In the donut visualization, select Order Priority Critical.
- Click Save .
- In the workbook canvas, right-click and select City by Sales and Order Priority.
The target workbook opens with the filter and parameter values from the source workbook.
Learn More
Pass Parameters Through an Analytics Link
F82055-01
July 2023
Copyright © 2023, Oracle and/or its affiliates.
Learn how to pass parameter values from a source Oracle Analytics workbook to a target workbook using an analytics link data action.
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial computer software" or "commercial computer software documentation" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract. The terms governing the U.S. Government's use of Oracle cloud services are defined by the applicable contract for such services. No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc, and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle.