Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
pratyushg13
Explorer
2,213

SAP Analytics Cloud allows you to create interactive dashboards and automate actions using scripting. A common requirement is to pass values selected in dropdowns directly into a Data Action. This guide walks through how to link dropdown inputs to Data Action parameters using scripting.

pratyushg13_0-1748007276845.png

Step 1: Create the Data Action

  • Go to the Main Menu and select Data Action.
  • Create a new Data Action.
  • Define your dynamic parameters.
  • Add your required calculations or steps using those parameters.

Example: Let’s assume your Data Action uses 1 measure and 1 dimension.

pratyushg13_2-1748007802861.png

Step 2: Set Up the Story

Step 3: Set Up the Data Action in the Story

  1. In the left-side panel, open the Scripting section.
  2. Click the + and choose Data Action.
  3. Name your data action (e.g., DataAction_1).

pratyushg13_3-1748007802862.png

     4. In the Detail section, assign the data action you created earlier.

Step 4: Add a Trigger Button

  1. Go to the Insert menu and add a Button to your story.
  2. Select the Button, then open the Script Editor.
  3. In the onClick() event, use the following script as an example:
var pVersion=Dropdown_1.getSelectedKey();
var pMeasure=Dropdown_2.getSelectedKey();

DataAction_1.setParameterValue("TargetVersion",pVersion);
DataAction_1.setParameterValue("measure1",pMeasure);

if(DataAction_1.execute()){
Application.showMessage(ApplicationMessageType.Success,"DA run succesfully");
Application.refreshData();}
  • Here, Targetversion and measure1 are the parameter names defined in your Data Action.
  • Dropdown_1 and Dropdown_2 are the IDs of your dropdown widgets.

Step 5: View Mode and Execution

  • Switch to View Mode.
  • Use the dropdowns to filter or select values.
  • Click the Button.
  • The Data Action will execute with the parameter values fetched directly from the dropdowns.

Conclusion

By using scripting in SAC stories, you can efficiently pass dropdown values into Data Actions. This approach makes your dashboards dynamic and user-driven, enabling better interactivity and automation.

This pattern is ideal for what-if scenarios, scenario planning, or on-the-fly calculations based on user inputs.

Try adapting it to your own use cases and streamline the planning experience!