Exploring SAP Analytics Cloud: Scripting Features
Exploring SAP Analytics Cloud: Scripting Features to Enhance Dashboards
SAP Analytics Cloud (SAC) is a powerful tool that allows users to build interactive dashboards and reports. Beyond the drag-and-drop interface, SAC also offers scripting capabilities through Analytic Application that allow for more dynamic interactions and customization. Let’s explore how you can use scripting in SAC to enhance your dashboard.
1. Adding a Measure to a Widget (Bar Chart)
You can programmatically add or change measures in a chart widget, which allows for dynamic customization of the data being displayed. Here's how you can add a measure to a bar chart using a script.
In this example:
Chart_1is the ID of your bar chart widget.- The
getDataSource()method retrieves the chart’s data model. - The new measure,
"Gross Margin", is added to the list and applied to the chart.
2. Changing a Dimension Programmatically
Similarly, you can modify a dimension in a chart or table through scripting. This is useful when you want to offer users the ability to switch between different dimensions for analysis.
In this case:
"Product Category"is the new dimension to be displayed.- We fetch the current dimensions using
getDimensions()and replace one of them with the new dimension.
3. Dynamic User Interactions with Dropdowns
To make these changes even more dynamic, you can integrate these scripts with dropdown menus or buttons in your dashboard, enabling end users to choose the measure or dimension they want to view.
For example, updating a chart based on user selection in a dropdown:
4. Dynamic Filtering Based on User Input
You can dynamically filter charts, tables, or data models based on user input from dropdowns, input fields, or button clicks. This is particularly useful when you want to allow users to drill down into specific categories or time periods.
Example: Filtering a chart based on selected date range
5. Conditional Formatting Based on Thresholds
You can apply conditional formatting to your visualizations based on threshold values defined through scripting. This is particularly useful for highlighting outliers or performance metrics that exceed or fall short of targets.
Example: Applying conditional formatting to a table based on sales performance
Comments