I - Passing datasource filters to child application
Filtering the table using dropdown selection and passing the same filters to the child application
On Initialization - loading the dropdown with location keys
var location= Table_1.getDataSource().getMembers("Location_4nm2e04531");
Dropdown_1.addItem("Choose Location","Choose Location");
for(var i=0;i<location.length;i++)
{
Dropdown_1.addItem(location[i].id,location[i].description);
}
Dropdown_1.setSelectedKey("Choose Location");
On selection of location from dropdown, table's datasource gets filtered for specific location
Table_1.getDataSource().setDimensionFilter("Location_4nm2e04531",Dropdown_1.getSelectedKey())
Filter value is to be passed to child application
Step 1:
Create script variable and check the "Expose Variable via URL Parameter" option
Step 2:
On click of button "Navigate to Trend Analysis", call below function by passing child application's application id
Step 3:
Get the filters applied to the table's data source. In our use case, we are filtering data in table using location drop down
Step 4:
getFilter() is standard reusable function which fetches the filter values. In our use case it is a single value but this function can be leveraged to handle both single and multiple values, range filters and also exclude option
Step 5:
Once filter value is retrieved from getFilter function, create URL parameter
UrlParam_Filters = filterInfo;
var urlParam_Filter1 = UrlParameter.create("p_Filter",UrlParam_Filters);
"Filter" is a global script variable in child application. When indicating the same in the URL parameter, it has to be mentioned as "p_Filter"
On selecting the location from dropdown, table gets filtered as below
Child Application
As "Portland" location is passed, we see filter applied in the child application for the same.
Script to be included in the Child Application
Step 1:
Create parameter "Filter" with "Expose variable as URL parameter" option
Step 2: Invoke the setFilter function in the initialization script
II - Passing constant values to child application
Value selected from radio button is passed as constant value to child application. As sample scenario, I am passing true/false values to the child application and accordingly changing visibility of table data source in the child application
Step 1:
Create parameter in parent application "p_Visible" with "Expose variable as URL parameter" option checked
Step 2:
Capture the value of radio button. Check line # 14 to 16 in below script. Create UrlParameter
var urlParam_Filter2 = UrlParameter.create("p_Visible",p_Visible);
"Visible" is global script variable in child application but it is to be represented as "p_Visible" in the code.
Step 3:
Check the openApplication syntax where we are passing both URL parameters to the child application. One is datasource filter and other is constant value. As we have more than one URL parameters to pass, it is mentioned within square braces
NavigationUtils.openApplication(appID,[urlParam_Filter1,urlParam_Filter2]);
Step 4:
"Visible" is parameter in child application. Based on the value if passed constant parameter value, widgets visibility is controlled
URL with both parameters that gets generated
<<SAC Tenant URL>>/app.html#/analyticapp&/aa/CAEA94048C8C010DD59CCE953ABCA400/?p_Visible=True&p_Filter=Location_4nm2e04531$Single$CT13$false$&url_api=true&mode=present&view_id=appBuilding
Conclusion:
Leveraging this feature, parameters can be passed between analytics applications. This would be useful in multiple use cases
Reference:
Generic SAC Content : https://blogs.sap.com/2021/05/04/sap-analytics-cloud-sample-content-generic-analysis-application-url...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |