8

SAP Analytics Cloud – How to drive Analytic Application based on user-defined UR...

 2 years ago
source link: https://blogs.sap.com/2022/08/03/sap-analytics-cloud-how-to-drive-analytic-application-based-on-user-defined-url-parameter/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
August 3, 2022 2 minute read

SAP Analytics Cloud – How to drive Analytic Application based on user-defined URL Parameter

There may be a requirement when we have to link two documents across platforms like Web Intelligence documents or SAP Analytics Cloud Story to Analytic Application as destination, we may face challenges with regard to passing the relevant information to the Analytic Application. We may also be challenged to use this information as basis to filter/display data in Analytic Application. This blog will address steps to handle both these challenges.

This blog post will demonstrate how you could drive a SAC Analytic Application based on a user-defined URL parameter set from another application.

This blog also describes how a URL parameter is defined and used as filter in Analytic application.

Analytic Application URL:

A URL for Analytic Application typically has following components:

https://<Tenant>/sap/fpa/ui/tenants/<Tenant-ID>/bo/application/<app_ID>?mode=<mode_type>&view_id=<view-type>&(list of parameters and values separated by &)

Defining a User-defined Parameter:

Create a new Scripting Variable by clicking on + and set other properties as below:

URL-Script-variable1-2.png

Create script variable

Note: Don’t give the prefix ‘p_’ in the name, even when you select Expose variable via URL parameter.

In the onInitialization() function of Canvas, add following code:

SAC-filter-coding-4.png

Code to enable dimension filtering based on parameter value

Save the application and Run the Analytic Application.

The analytic application runs in a new tab, add the following at the end of the URL generated:

&p_parameter1=<value>

URL2-1.png

URL with parameter

Note: Add prefix ‘p_’ in parameter name, even when it was not mentioned in script variable.

And you can see that the data is being filtered with the value set in URL.

To further, optimize the application so that it runs and returns full set of data even when the parameter is not set or when you execute the URL without the parameter suffixed, you can use following code:

SAC-fex-filter-code-2.png

Optimized code to run application without the parameter set

Then use the URL along with parameter to open the analytic application from other applications, like SAC story etc.

Please share your feedback how you like the post and whether it was helpful.

Thanks!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK