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!
Showing results for 
Search instead for 
Did you mean: 

Image Source:

Welcome to our tutorial blog on how to utilize input controls in SAP Analytics Cloud (SAC) to enhance data actions. SAC empowers users to gain valuable insights from data through interactive visualizations and intelligent analytics. By integrating input controls and data actions, we can create more dynamic and user-driven analytics experiences. In this blog, we'll walk you through the process of passing input control values to data actions using JavaScript, leading to better data analysis and exploration. This method is supported in Stories and Analytic Application

Step 1: Set Up Data Action Script Object

First, we need to create a data action script object to handle the interaction between input controls and data actions. Follow these steps to set up the script object:

In your SAP Analytics Cloud dashboard, navigate to the "Stories" view.
Click on the "Data Actions" button (three dots icon) in the toolbar and select "Create Data Action Script Object."

Name your script object appropriately, providing a clear description of its purpose.
Choose the relevant dataset or model for the script object to apply.
Configure the desired behavior of the data action, such as adding filters or replacing data.

Step 2: Add an Input Control for the Dimension

Next, we'll create an input control for the dimension we want to pass to the data action. For example, let's assume we want to filter data based on a date dimension.

In the "Stories" view, click on the "Insert" tab in the toolbar.
Select the "Input Control" option, and then choose the appropriate input control type (e.g., "Date" for our example).

Configure the input control settings to match your dataset and dimension requirements.
Place the input control on your dashboard where users can interact with it.

Step 3: Create a Button and Insert the JavaScript Code

We'll create a button on the dashboard, and when users interact with the input control and click the button, the selected value will be passed to the data action. Here's the JavaScript code to achieve this:

var filter_values = ArrayUtils.create(Type.string);
var input_control = <input_control_name>.getInputControlDataSource().getActiveSelectedMembers();

for(var i = 0 ; i < input_control.length; i ++){

<Data_Action_Object_Name>.setParameterValue("<Data_Action_Parameter_Id>", filter_values);

Please replace <input_control_name> with the name of your input control and <Data_Action_Object_Name> with the name of the data action script object you created in Step 1. Also, adjust the <Data_Action_Parameter_Id> to match the parameter ID in your data action.


var filter_values = ArrayUtils.create(Type.string);
var input_control = date_input.getInputControlDataSource().getActiveSelectedMembers();

for(var i = 0 ; i < input_control.length; i ++){

DataAction_1.setParameterValue("Date", filter_values);


Step 4: Test the Interaction

Save your changes and navigate to the "Stories" or "Analytics Application" view to test the interaction. Now, when you select date values in the input control and click the button, the JavaScript code will trigger the data action. The data action will then use the selected date values as parameters and perform the defined action, such as filtering the dataset based on those dates.


By integrating input controls and data actions using JavaScript in SAP Analytics Cloud, you can empower users to interactively explore data and gain more valuable insights. The combination of input controls and data actions provides a powerful toolset to create dynamic, user-driven analytics experiences. Experiment with different input controls and data actions to enhance your SAC dashboards and elevate your data analysis to new heights. Happy analyzing!
Labels in this area