In the previous blog in this series, we learned about Script Objects. In this blog, let us look at the Slider and Range Slider Widgets that can even be used as measure filters in an analytic application.
* * *
The slider can be used by the end-user to dynamically change a number while Range Slider allows them to select a range using two-way slider. You can only map numbers to both the widgets.
Slider & Range Slider Widgets in Action
Here the Slider is used by the end user to change the discount percentage which is then used to calculate Sales, Profit/Loss value and percentage to simulate different what-if scenarios.

Here the Range Slider is used to filter the Stores that has Gross Margin within the range selected.

Add and Configure Slider Widget
Insert a Slider widget and configure it in the Builder Panel.

- Min Value and Maximum Value defines the upper and lower limit.
- Current Value is the default value on application start up.
- Step Size – Minimum increase/decrease when you drag the slider. For step size 1, the possible values are 0, 1, 2, 3… For step size 5, possible values are 0, 5, 10, 15…
- Enable Value Input so that the user can double click on the slider handle and manually enter the value.

Link Script Variable in Calculated Measure
Create a script variable of type Number. Then in the onChange event of Slider Widget assign the selected value of the Slider to the script variable. Here Discount is the script variable in which the getValue() is used to assign the selected integer.

Now use the script variable Discount in Calculated Measures so that the values change dynamically.

Add and Configure Range Slider Widget
Insert and configure the Range Slider.

In Range Slider default start and end value can be configured. In both the widgets, step size can be a fraction too.
Add Hidden Table and Script to Filter Stores
Add the following script in the onChange event of the Range Slider.

Here in the script getData() function is used to get the Gross Margin of each Store and then the Stores that has values within the range is filtered. Since you need to check the values for all the Stores without the influence of filters, add a Table and hide it. This hidden table(Table_Hidden) can be used to check the values of each Store. The stores with Gross Margin within the range is assigned to a local array variable(filtered_stores) which is then used to filter the table(Table_Main) that is visible to the end user.
Slider and Range Slider can also be used to filter dimensions that are numbers(years, months, bottle pack, etc.) filter measure values, dynamic calculations or script logics.
***
Reach out to us here today if you are interested in evaluating if SAP Analytics Cloud is right for you. To know about the Analytic Applications of SAP Analytics Cloud, please check out our blog series here.