Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
627

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

  1. Enhanced Data Exploration: Users can drill down into data effortlessly, enhancing their ability to uncover insights.
  2. Advanced Features Utilization: The Data Analyzer offers various data exploration features that are readily accessible.
  3. 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:

  1. Script on "Onclick" Function: Write the script for the table's Onclick function.
  2. Call NavigationUtils Class: Utilize this class to facilitate navigation.

 

URL Parameters

himanshu_ts_sharma_2-1738612582579.png

 

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

himanshu_ts_sharma_1-1738612545313.png

 

  • 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>Val
    • Example:
      • f01Dim for the first filter dimension
      • f01Val for the first filter value
  • Variables:
    • Pattern: v<number>Par and v<number>Val
    • Example:
      • v01Par for the first variable parameter
      • v01Val 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

Labels in this area