Navigating to BI Content in OBIEE11g and Passing Multiple Parameters
Hello everyone, I'm Francesco Tisiot a new Rittman Mead consultant, in this post I'll explain how to achieve custom navigations to BI content passing multiple parameters on Oracle BI 11g and a way to include that functionality in the Action Framework.
First of all, what does a "custom navigation to BI content" mean?
OBIEE developers can associate many actions to every column used in a report (called Analysis in OBIEE 11g terminology). This is done by editing the "Interaction" tab under Column Properties menu. One of the actions available is "Navigate to BI content" and allows to navigate to a Dashboard Page or a Analysis passing the context as parameter. The context passed includes the details of the column clicked on, the value for that particle row and all the prompts applied to the calling analysis.
"Navigate to BI Content" solves the majority of navigation cases, but what happen if you want to navigate to a Dashboard or Analysis passing not only the current column value and context but also filtering for other fields maybe depending upon other column's value? This is what I call "custom navigation to BI content" and below you'll find a solution to include it into the action framework.
The solution is based on PortalPageNav and GoNavEx Javascript functions provided by OBIEE allowing navigation to dashboard pages and analysis.
PortalPageNav function definition is the following
function PortalPageNav (Event, Dashboard, Page, Tbl1, Col1, Val1, Tbl2, Col2, Val2 ....)
where parameters are:
- Event: event object, should represent the click but is never checked or used by OBIEE
- Dashboard: Path to the dashboard (/shared/FOLDERNAME/_portal/DASHBOARDNAME)
- Page: Page name
- Tbln: Presentation table to filter
- Coln: Presentation column to filter
- Valn: Value to filter by
Action Framework
The Action Framework, is an OBI EE component (introduced in version 11g) that provides functionality for creating, managing and invoking actions. These actions could provide functions like navigation to related content or external system calls (e.g. invoking functions, operations or process to external systems).
Actions are created and managed in the Oracle BI Presentation Services user interface and can be included within analyses, dashboards, agents, KPIs, and Scorecard objectives. There are several different types of actions, for example, Navigate to a BI Content or Web Page, Invoke a Web Service, and Invoke a Browser Script.
"Invoke a Browser Script" Action
One of the definable actions is the "Invoke a Browser script" that provides a way to initialising a pre-defined browser script (e.g. javascript function) stored in the server, retrieving it, adding parameters and finally executing it in the client's browser.
In order to include browser script actions in OBI EE 11g Action Framework you'll need to edit UserScript.js that can be found at:
<middleware home>/user_projects/domains/bifoundation_domain/servers/bi_server1/tmp/_WL_user/analytics_11.1.1.2.0/<installation dependent folder>/war/res/b_mozilla/actions/UserScripts.js
UserScript.js contains the browser script action definitions and by default it includes several examples of browser scripts.
Every browser action definition in UserScript.js is composed by two parts:
- A function containing the actual code to be called when the action is invoked
- A (optional) "publish" associated function containing the parameters definition, used by Action Framework for mapping values to the function parameters.
New functions should use the namespace USERSCRIPT in order to avoid function name conflicts occur with the product code, and to allow the Action Framework identifying functions when creating an action.
You can find all the instructions to include custom Javascript functions in the Integrator's Guide for Oracle Business Enterprise Edition Chapter 4.
Remember, when migrating or deploying OBI EE to other environments, to copy UserScripts.js in new environments too.
PortalPageNav in Action Framework
The function that includes PortalPageNav is the following:
USERSCRIPT.customPortalPageNav = function(arg_array){ var str="parent.PortalPageNav(1"; for(args in arg_array){ var arg_name=args; var value=arg_array[arg_name]; str+=",'"+value+"'"; } str+=")"; eval(str); };
Basically customPortalPageNav function is creating a string containing:
PortalPageNav(1, first_parameter, second_parameter, third_parameter ...)
In order to make it visible from the Analytics Menu you'll need to add a "publish" function like the below
USERSCRIPT.customPortalPageNav.publish={parameters:[ new USERSCRIPT.parameter("1","Dashboard","/shared/FOLDERNAME/_portal/DASHBOARDNAME"), new USERSCRIPT.parameter("2","Page","Insert your Page"), new USERSCRIPT.parameter("3","Table","Insert Table"), new USERSCRIPT.parameter("4","Column","Insert Column"), new USERSCRIPT.parameter("5","Value","Insert Value")]};
Once created those functions clear browser cache and restart Presentation Service. You should then be able to use customPortalPageNav function by selecting Column Proprieties > Interaction > Value Primary Interaction > Action Links > Add > New > Invoke a Browser Script
And after selecting customPortalPageNav from the menu.
You should then be able to edit the parameters
The default customPortalPage function contains only one (Table, Column, Value) triple to filter by but you can add as many triples (Table,Column,Value) as you want as shown in the image below.
Finally please note that every parameter could be either a Static Value, a Session Variable, a Repository Variable or a Column Value providing the maximum level of flexibility.
That's everything for now, enjoy customPortalPageNav!