SAC | Passing URL Parameters from Optimized Story to Data Analyzer

Estimated read time 8 min read

Introduction

In this blog, we explore how to seamlessly pass URL parameters from an SAP Analytics Cloud (SAC) Optimized Story to the SAC Data Analyzer. This integration enhances data exploration capabilities by allowing users to drill down into data at deeper levels based on their specific requirements. Moreover, it enables the SAC Data Analyzer to open in the same state as the story, preserving filters and variables, and thus providing a more fluid and personalized data analysis experience.

Blog Highlights

This blog focuses on:

Writing script to pass a user’s selection from an SAC story to the Data Analyzer.Utilizing SAC’s scripting classes to achieve parameter passing.Demonstrating practical use cases for enhanced data exploration.

Benefits of Passing URL Parameters

Enhanced Data Exploration: Users can drill down into data effortlessly, enhancing their ability to uncover insights.Advanced Features Utilization: The Data Analyzer offers various data exploration features that are readily accessible.State Preservation: By passing filters and variables, the Data Analyzer can open in the same state as the story, aligning with user needs and context.

Key Scripting Classes

To achieve the parameter passing, we utilize the following scripting classes:

NavigationUtils: Facilitates navigation and opening of the Data Analyzer.URLParameter: Handles the creation and management of URL parameters.

Opening Data Analyzer from the Optimized Story

To open the Data Analyzer from an optimized story, the following scripting classes play a crucial role:

Example Scenario

Suppose a user wants to open the Data Analyzer by clicking on a table within the SAC story. The steps are as follows:

Script on “Onclick” Function: Write the script for the table’s Onclick function.Call NavigationUtils Class: Utilize this class to facilitate navigation.

 

URL Parameters

 

Creating URL parameters is essential for passing filters and variables. The URLParameter class is used for this purpose. Parameters to be specified include:

parameterName: Defines the parameter name to be passed, using specific naming patterns for filters and variables:Filters: Use the pattern f<number>Dim (e.g., f01Dim for filter 1).Variables: Use the pattern v<number>Par (e.g., v01Par for variable 1).parameterValue: Corresponds to filter and variable values, matching the number in parameterName.

Example Code Snippet

 

 

NavigationUtils.openDataAnalyzer(“<Connection Name>”,
“<DataSource Name>”,
[
UrlParameter.create(“f01Dim”,”<Dimension Name>”), // filter 1
UrlParameter.create(“f01Val”,”<Filter Value>”), // filter 1 value
UrlParameter.create(“f02Dim”,”<Dimension Name>”), // filter 2
UrlParameter.create(“f02Val”,”<Filter Value>”), // filter 2 value
UrlParameter.create(“v01Par”,”<Variable ID>”), // variable 1
UrlParameter.create(“v01Val”,”<Variable Value>”) // variable 1 value
],
true);

 

 

Parameters Explained

 

Connection: Specify the connection ID as a string.dataSourceName: Provide the data source name, such as a Query name in case of BEx.Parameters: Define URL parameters, including filters and variables.newTab: Set to true to open in a new tab, or false to open in the same tab.

After running the story the URL created after the clicking the table will look like :

 

 

https://<tenant>#/dataanalyzer&/dz/?view_id=dataAnalyzer&connection=<Connection Name>&dataSourceName=<DataSource Name>&f01Dim=<Dimension Name>&f01Val=<Filter Value>&f02Dim=<Dimension Name>&f02Val=<Filter Value>&v01Par=<Variable ID> &v01Val=<Variable Value>

 

 

Understanding URL Parameters

URL parameters in SAC are used to pass specific filters and variables from an Optimized Story to the Data Analyzer. This ensures that the Data Analyzer opens in the same state as the story, maintaining the user’s context and selections.

Key URL Parameter Patterns

Filters:Pattern: f<number>Dim and f<number>ValExample:f01Dim for the first filter dimensionf01Val for the first filter valueVariables:Pattern: v<number>Par and v<number>ValExample:v01Par for the first variable parameterv01Val for the first variable value

For more information regarding URL Parameters visit the following link :

SAP Help Portal | URL Parameters 

Conclusion

Passing URL parameters from an SAC Optimized Story to the Data Analyzer significantly enhances data exploration and user experience. By preserving the state of filters and variables, users can continue their analysis seamlessly. This scripting approach, leveraging SAC’s powerful scripting classes, facilitates effective navigation and interaction between SAC components, empowering users to derive deeper insights.

If you are here, thank you so much for taking out your time to read this. Your feedback will be highly appreciated.

Thanks,
Himanshu

 

​ IntroductionIn this blog, we explore how to seamlessly pass URL parameters from an SAP Analytics Cloud (SAC) Optimized Story to the SAC Data Analyzer. This integration enhances data exploration capabilities by allowing users to drill down into data at deeper levels based on their specific requirements. Moreover, it enables the SAC Data Analyzer to open in the same state as the story, preserving filters and variables, and thus providing a more fluid and personalized data analysis experience.Blog HighlightsThis blog focuses on:Writing script to pass a user’s selection from an SAC story to the Data Analyzer.Utilizing SAC’s scripting classes to achieve parameter passing.Demonstrating practical use cases for enhanced data exploration.Benefits of Passing URL ParametersEnhanced Data Exploration: Users can drill down into data effortlessly, enhancing their ability to uncover insights.Advanced Features Utilization: The Data Analyzer offers various data exploration features that are readily accessible.State Preservation: By passing filters and variables, the Data Analyzer can open in the same state as the story, aligning with user needs and context.Key Scripting ClassesTo achieve the parameter passing, we utilize the following scripting classes:NavigationUtils: Facilitates navigation and opening of the Data Analyzer.URLParameter: Handles the creation and management of URL parameters.Opening Data Analyzer from the Optimized StoryTo open the Data Analyzer from an optimized story, the following scripting classes play a crucial role:Example ScenarioSuppose a user wants to open the Data Analyzer by clicking on a table within the SAC story. The steps are as follows:Script on “Onclick” Function: Write the script for the table’s Onclick function.Call NavigationUtils Class: Utilize this class to facilitate navigation. URL Parameters Creating URL parameters is essential for passing filters and variables. The URLParameter class is used for this purpose. Parameters to be specified include:parameterName: Defines the parameter name to be passed, using specific naming patterns for filters and variables:Filters: Use the pattern f<number>Dim (e.g., f01Dim for filter 1).Variables: Use the pattern v<number>Par (e.g., v01Par for variable 1).parameterValue: Corresponds to filter and variable values, matching the number in parameterName.Example Code Snippet  NavigationUtils.openDataAnalyzer(“<Connection Name>”,
“<DataSource Name>”,
[
UrlParameter.create(“f01Dim”,”<Dimension Name>”), // filter 1
UrlParameter.create(“f01Val”,”<Filter Value>”), // filter 1 value
UrlParameter.create(“f02Dim”,”<Dimension Name>”), // filter 2
UrlParameter.create(“f02Val”,”<Filter Value>”), // filter 2 value
UrlParameter.create(“v01Par”,”<Variable ID>”), // variable 1
UrlParameter.create(“v01Val”,”<Variable Value>”) // variable 1 value
],
true);   Parameters Explained Connection: Specify the connection ID as a string.dataSourceName: Provide the data source name, such as a Query name in case of BEx.Parameters: Define URL parameters, including filters and variables.newTab: Set to true to open in a new tab, or false to open in the same tab.After running the story the URL created after the clicking the table will look like :  https://<tenant>#/dataanalyzer&/dz/?view_id=dataAnalyzer&connection=<Connection Name>&dataSourceName=<DataSource Name>&f01Dim=<Dimension Name>&f01Val=<Filter Value>&f02Dim=<Dimension Name>&f02Val=<Filter Value>&v01Par=<Variable ID> &v01Val=<Variable Value>   Understanding URL ParametersURL parameters in SAC are used to pass specific filters and variables from an Optimized Story to the Data Analyzer. This ensures that the Data Analyzer opens in the same state as the story, maintaining the user’s context and selections.Key URL Parameter PatternsFilters:Pattern: f<number>Dim and f<number>ValExample:f01Dim for the first filter dimensionf01Val for the first filter valueVariables:Pattern: v<number>Par and v<number>ValExample:v01Par for the first variable parameterv01Val for the first variable valueFor more information regarding URL Parameters visit the following link :SAP Help Portal | URL Parameters ConclusionPassing URL parameters from an SAC Optimized Story to the Data Analyzer significantly enhances data exploration and user experience. By preserving the state of filters and variables, users can continue their analysis seamlessly. This scripting approach, leveraging SAC’s powerful scripting classes, facilitates effective navigation and interaction between SAC components, empowering users to derive deeper insights.If you are here, thank you so much for taking out your time to read this. Your feedback will be highly appreciated.Thanks,Himanshu   Read More Technology Blogs by Members articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author