Scripting Patterns and Examples

When you start writing scripts in SAP Analytics Cloud, analytics designer, it might be helpful for you to go through typical use cases and examples for scripting in analytic applications. This helps you adjust the scripts to your business needs.

Here you can find typical scripting patterns and examples to help you script with SAP Analytics Cloud, analytics designer:
Name Use Case More Information
Enable planning option and API Enable planning for tables to let planners input data Use Planning Enabled Property and setEnabled API
Version management APIs on SAP Analytics Cloud data models: publish version API Publish public or private versions of planning data Use publish API on Versions
Version management APIs on SAP Analytics Cloud data models: publish as public version API Publish a private version as a public one Use publishAs Public Version API
Version management APIs on SAP Analytics Cloud data models: revert version API Revert versions of planning data Use revert API on Versions
Version management APIs on SAP Analytics Cloud data models: delete version API Delete a public or private version Use deleteVersion API
Version management APIs on SAP Analytics Cloud data models: copy version API Create a private version from an existing version Use copy API on Versions
Version management APIs on SAP Analytics Cloud data models: getOwnerId API Check if a private version is owned by the current user Use getOwnerId API
Version Management on SAP BPC Models Version Management APIs for SAP Business Planning Consolidaton models Use Version Management APIs on SAP BPC Models
Calendar task APIs Change status and properties of a calendar task Use Calendar Integration Technical Objects and Calendar Task APIs
Possible error messages How to prevent error messages when using APIs Possible Error Messages in the Context of Version Management APIs
setUserInput and submitData API Change the value of a cell in a table at runtime Use setUserInput and submitData Planning APIs
Data locking APIs Check if a model is data locking enabled and set or get data locks Use Data Locking APIs
APIs related to BPC planning sequence Run a BPC planning sequence, open the prompt dialog to modify the variable, set, get, remove or copy the variable values Use APIs Related to BPC Planning Sequence
Formatting APIs Format certain values in an application Use Formatting APIs to Format Numbers and Dates
Refresh data API Trigger data refresh Use Refresh Data API
Pause refresh options and APIs Pause data refresh Use Pause Refresh Options and APIs
Navigation APIs Navigate through analytic applications Use Navigation APIs
Layout APIs Set widget size and position dynamically in the application Use Layout APIs
APIs for story filters and variables Show or hide filter panel, set, get or remove story filters and variables Use APIs on Story Filter and Variables
Selection APIs for tables and charts Retrieve the currently selected members and their dimensions Use Selection API for Tables and Charts
Result set APIs Get a result set based on an input data selection in a table or chart Use Result Set APIs
Range and exclude filters Set range and exclude filters Use API on Range and Exclude Filters
getVariableValues API Return an array of the current values of a specified variable Use getVariablevalues API
getDimensionFilters API Return an array of the current values of a specified dimension Use getDimensionFilters API
openSelectModelDialog and setModel API Change the table's model at runtime either by calling the selection dialog for models or directly with a valid model ID Use openSelectModelDialog and setModel APIs
NULL members and total members NULL members and total members are supported in script APIs. NULL Members and Totals Members in Scripting APIs
sendNotification API Send notifications to application users Use sendNotification API
Comment-related APIs Handle data cell comments, widget comments and comments on comment widgets Use Comment-Related APIs
Busy indicator APIs Define busy indicators on different levels for long-running actions Define Busy Indicators and Use Related APIs
APIs to get user information Get information, teams and roles of user Use APIs to Get User Information
Example 1: OData Actions in an Application Execute OData actions exposed by a connected on-premise system Scripting Example 1: Use OData Actions in Analytics Designer or Optimized Story Experience
Example 2: OData Actions in an Application Display backend system's response in an application Scripting Example 2: Use OData Actions in Analytics Designer or Optimized Story Experience

Best Practices

Here you can find typical use cases for creating analytic applications and setting up the interaction among widgets by scripting:

Use Case More Information
Switch between a chart and a table by using a toggle Best Practice: Switch Between Chart and Table
Filter a table or a chart by using a single measure selected from a dropdown Best Practice: Filter Table and Chart Through Dropdown (Single Selection)
Filter a table or a chart by using multiple measures selected from a checkbox group Best Practice: Filter Table and Chart Through Checkboxes (Multi-Selections)
Filter a table, a chart or an R visualization by using a filter line Best Practice: Use Filter Line for Filtering Switchable Table and Chart
Filter dimensions and display data according to hierarchies Best Practice: Filter Table and Chart Through Cascaded Filtering
Control which measures and dimensions are displayed in tables Best Practice: Add and Remove Dimensions on a Table
Filter a table or a chart by using popup window Best Practice: Filter Table and Chart Through Settings Panel (Popup Window)
Create and open a popup window that contains extra information about the selected element Best Practice: Handle Selections in Table and Chart and Open a Details Popup