In the previous blog in this series, we learnt about Navigation Utility function. In this blog, let us take a closer look at passing filter parameters to Story.

* * *

Navigation Utility function openStory() has an optional argument where you can pass URL parameters to Story. This URL parameter can be of three types – display, filter and variable. Here we are specifically exploring the option to pass filters.

Filter Parameters

There are six types of parameters that can be passed via URL to any Story when you want to create a Story Filter. The following list shows the type of parameter, syntax and whether it is optional or required.

  1. Model ID (Syntax: f<XX>Model, Required)
  2. Dimension ID (Syntax: f<XX>Dim, Required)
  3. Hierarchy Name (Syntax: f<XX>Hierarchy, Optional)
  4. Include / Exclude (Syntax: f<XX>Op, Optional)
  5. Unbooked (Syntax: f<XX>Unbooked, Optional)
  6. Filter Value (Syntax: f<XX>Val, Required)

In the syntax mentioned above <XX> can be any natural number less than or equal to 99. This is used when you want to create several Story filters. The parameters with the same number will act as a single set.

One important information to note is that every filter passed to a Story act as a Story Filter. Page-Level Filters or other selections like Input Control cannot be passed. If there is any existing Story Filter for the dimension that you pass in URL, then the value is overwritten.

Finding the IDs

Before appending the parameters in the Navigation utility function, let us see how to find the required IDs. Model ID should be in the format <package_name>:<object_name>. You can find the object_name of the model in the browser URL when you open a model. To find the whole model ID, you can visit the URL – https://<TENANT>/api/v1/stories?include=models where <TENANT> should be replaced with your SAC tenant URL. This URL will show all the Stories and the Model IDs used in them.

sap-analytics-cloud-application-design-series-18-passing-filter-parameter-story

Finding Model ID from URL

Here you can search for the Story or the object_name and then find the whole ID of the model including the package_name.

IDs of Dimensions can be found within Model Summary when you open a model or when you hover over the dimension within Builder panel while creating a Story. Similarly, you can find the Key value of a member within dimension details when you open a model or when you enable display settings to show member ID while creating a Story.

openStory Function

Now that you know about different parameters and how to find the required IDs, let us see how to append various parameters in Navigation Utility function. Filter parameters need to be appended as an array and then passed as an argument i.e. URL parameter. In the example below, 01 is the unique number that replaces <XX>.

  • ‘f01Model’ is the parameter name for model ID and ‘t.T.CB3ZK1MOW2R6KAME6HRNTDE4N4:CB3ZK1MOW2R6KAME6HRNTDE4N4’ is the ID of the model (in format <package_name>:<object_name>).
  • ‘f01Dim’ is the parameter name for dimension ID and ‘Segment’ is the ID of Dimension.
  • ‘f01Val’ is the parameter name for filter value and ‘Consumer’ is the ID of the member to be filtered.
  • ‘f01Op’ is the parameter name that mentions whether to include (‘in’) or exclude (‘notIn’) the filter value.
sap-analytics-cloud-application-design-series-18-passing-filter-parameter-story

Passing simple filter parameter

The above function opens an existing Story and creates a Story Filter for Dimension Segment by only including the member Consumer.

Combining URL Parameters

You can combine multiple URL parameters when using the openStory() function. The following example combines the display and filter parameter. Filter Parameter includes multiple Story filters passed as two different sets identified using the natural numbers 01 and 02.

sap-analytics-cloud-application-design-series-18-passing-filter-parameter-story

Combining multiple URL Parameters

The above example passes a display parameter that mentions the Story to be opened in the present mode. The first Story Filter is passed to create a filter on Segment by only including ‘Consumer’. The second Story Filter is passed to exclude the Cities – Dallas and Newark. The last argument false mentions that the Story should be opened in the same browser tab.

Analytics Designer automatically URL encodes the parameter values. The generated URL is shown below for reference.

https://…/app.html#;view_id=story;storyId=FDC9AEE18723F707A28BF76298E5A1B;pageId=a31b0d6e3421406bb05cf75255b6fe1;mode=present;f01Model=t.T.CB3ZK1MOW2R6KAME6HRNTDE4N4:CB3ZK1MOW2R6KAME6HRNTDE4N4;f01Dim=Segment;f01Val=Consumer;f02Model=t.T.CH5TV3HMH4ZZD3GX03H48ZY8:CH5TV3HMH4ZZD3GX03H48ZY8;f02Dim=City;f02Val=[%22Dallas%22,%22Newark%22];f02Op=notIn

You can see the above example in action below.

sap-analytics-cloud-application-design-series-18-passing-filter-parameter-story

Passing Filters to Story

 

Apart from using Navigation Utility function, you can also use the same URL parameter format when you embed a Story within an HTML page or even within an Analytic Application when you use the Web Page widget.

***

In the next blog, we will discuss in detail about Data Analyzer.

Click here to evaluate if SAP Analytics Cloud is right for you. To know about the Analytic Applications of SAP Analytics Cloud, please check out our blog series here.

 

Subscribe to our Newsletter

5920 Windhaven Pkwy
Plano TX 75093.

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com