Access the Optimized Story Experience API Reference Guide

You can create interactive and highly custom-defined stories using APIs provided by SAP Analytics Cloud. With the Optimized Story Experience API Reference Guide, you have direct access to all available APIs that you can use in your stories.
All objects, functions, properties, methods, and events available in such scripts are listed in this API reference.
The scripts consist of one or more statements written in the JavaScript subset language used by SAP Analytics Cloud, which follow a specific syntax. You can use these scripts in the script editor to enhance your stories in advanced mode.
Explore APIs in the Optimized Story Experience API Reference Guide
You can explore the APIs in many ways. In this example, we searched for the onClick event and you can see all the components that offer scripting on the onClick event displayed below the search field.

You can also look for the available scripting grouped by widget. In this example, Table was selected to view the available scripting. These APIs can also be used for other widgets. For example, in the scenario that follows getDataSource is used for Charts.

Scenario: Using getDataSource in Call Statements
Let’s use the example getDataSource, which is commonly used for different widgets such as charts and tables.

The API getDataSource returns the data source of the widget where this API is used, for example, CH_TaxesPerMonth.getDataSource(); returns data source of this chart.
Note
If you use a chart in a story, the data source is often a model. If you use two chart widgets that use the same model in your story (for example, one which displays data by region and the second data by product) then you still need getDataSource on both charts to enable other actions like filtering the chart.Syntax Used in Call Statements
Call statements execute an API method of an object. The basic syntax for call statements is: <Widget>.<Method>(<Arguments>);
<Widget> is the name of a data source alias or a component in your story. Ask yourself, which element should be influenced? For example, Table_1 or Button_1.
<Method> is an operation applied to the object specified on the left of the period. Ask yourself, what should be done with the element? The available methods depend on widget type. For example, data source objects provide methods to filter data, and visual components provide methods to modify visibility: setVisible, refreshData, or addItem.
<Arguments> is a comma-separated list of expressions. The passed expressions must match the requirements of the method. Ask yourself, which details are needed to do it? For example, Visibility = true, Key = DE, or Text = Germany.
Each statement ends with a semicolon (;).
In the example CH_TaxesPerMonth.getDataSource().setDimensionFilter("0CALYEAR","2018");
- <Widget> CH_TaxesPerMonth
- <Method>getDataSource and setDimensionFilter
- <Arguments> 0CALYEAR and 2018