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 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 the Planning APIs setUserInput and submitData
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
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 Range and Exclude Filters
getVariableValues API Return an array of the current values of a specified variable Use getVariablevalues API
getDimensionFilters APIs 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 the openSelectModelDialog and setModel APIs
NULL members and total memebrs 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
Example 1: OData Actions in an Application Execute OData actions exposed by a connected on-premise system Example 1: Use OData Actions in an Application
Example 2: OData Actions in an Application Display backend system's response in an application Example 2: Using OData Actions in an Application

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 Selection)
Filter a table, a chart or an R visualization by using a filter line Best Practice: Use Filter Line for Filtering Table, Chart and R Visualization
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 in Tables
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: Selection Handling in Table and Chart and Open a Details Popup