You are on page 1of 66

8/9/2020

SAP Analytics Cloud Help


Generated on: 2020-08-09

SAP Analytics Cloud | Q2 2020 (2020.8)

PUBLIC

Original content: https://help.sap.com/viewer/00f68c2e08b941f081002fd3691d86a7/release/en-US

Warning

This document has been generated from the SAP Help Portal and is an incomplete version of the official SAP product
documentation. The information included in custom documentation may not re ect the arrangement of topics in the SAP Help
Portal, and may be missing important aspects and/or correlations to other topics. For this reason, it is not for productive use.

For more information, please visit the https://help.sap.com/viewer/disclaimer.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 1/66
8/9/2020

Analytic Applications
An analytic application is a document that can contain visualizations such as tables, charts, and lters to allow navigation and
analysis of data. You can personalize the visualizations and interaction behaviors of the UI elements according to user
requirements. Analytic applications are created and consumed in SAP Analytics Cloud.

What is the Analytics Designer?


With SAP Analytics Cloud, analytics designer, you can create applications for data analysis and data planning. In contrast with
stories, analytic applications are created by few experts, but are consumed by many end users. All SAP Analytics Cloud licenses
include the consumption of analytic applications with read access. The design environment of the analytics designer is geared to
the needs of application designers, who create analytic applications that are tailored to satisfy application users' business needs.

The major difference compared to stories is that in analytic applications, you can con gure the behavior of the UI elements with a
set of speci c script API events, and specify which actions should take place when events are triggered. This exibility lets you
create a variety of analytic applications, ranging from simple static dashboards to highly customized analytic applications with
numerous options to browse and navigate data.

Find more details about the basics here: About Analytics Designer

Required Licences
All SAP Analytics Cloud licenses include the creation and consumption of analytic applications. For planning applications, please
note the following:

If you only need read access to existing planning models and create private versions only, you can use the SAP Analytics
Cloud for business intelligence license.

If you need to create public versions and use all planning features, the SAP Analytics Cloud for planning, standard edition is
required.

If you need to create or update planning models for your planning applications, the SAP Analytics Cloud for planning,
professional edition license is required.

Before You Start


As an application designer, make sure that you have got the permission for working with analytic applications. Administrators or
users who can edit roles need to add the Analytic Applications permission with create, read, update and delete rights to your role,
or assign the standard role Application Creator to you.

Make sure that the users who consume your applications have got the read rights for analytic applications in their roles.

See Granting Permissions for Analytic Applications in Roles.

Tasks
This image is interactive. Hover over each area for a description. Click highlighted areas for more information.

Related Information
Widget Reference
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 2/66
8/9/2020
Known Limitations to Analytics Designer
Features by License Type for Analytics Models
Features by License Type for Planning Models

About Analytics Designer


Here you'll nd the basics about the analytics designer that will help you understand what it's all about and how it works.

What is an analytic application?


An analytic application in SAP Analytics Cloud is an analytical application that visualizes data in various forms and lets you
navigate the data. It can also allow planning.

Analytic applications can range from simple static dashboards showing static numbers to highly customized applications with
many options to browse and navigate data, change the visualization, navigate across multiple pages or areas, up to an extensively
customized look and feel according to customer branding.

What is the Analytics Designer?


The analytics designer for SAP Analytics Cloud is the capability to create analytic applications.

There is a dedicated design environment in SAP Analytics Cloud in order to create such applications. The term design in analytics
designer doesn't refer speci cally to the UX or UI design aspect of an analytic application. It is the entire process of creating an
analytic application: de ning the data model, laying out the screen, con guring widgets, and wiring it all up with the help of
custom scripts.

The analytics designer offers you another way to create analytical content in SAP Analytics Cloud.

What can you do with analytic applications that you can't do with stories?
An analytic application typically contains some custom logic, expressed with the help of scripts. A story is created in a self-service
work ow and can comprise many laid-out widgets and a lot of con gured functionality. However, the amount of customization is
limited to the foreseen possibilities offered in the story design-time environment. With analytic applications there is much more
exibility to implement custom behavior. It also requires a higher skill level to create those.

How are stories and analytic applications related to each other?


From a consumption point of view, there shouldn't be any difference between stories and analytic applications. The consumer
shouldn't be aware of whether the analytical content is a story or an analytic application. The exposed widgets, the available
functionality, and the look, feel, and behavior should be the same.

However, analytic applications can use widgets, which do not exist for stories, and can have custom logic, which cannot be
implemented in stories since there is no scripting. In general, stories and applications share widgets and functionality to a large
extent, but some widgets can only be used in applications because they need to be scripted (dropdown boxes or buttons, for
example).

Why do we need both stories and analytic applications?


Stories and analytic applications share functionality and widgets may even have very similar design environments, so why are two
different artifact types necessary? The answer is that story designers and application designers have completely different
expectations. This is related to the differences between stories and applications.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 3/66
8/9/2020
In the story design environment, it's practically impossible for you to create a story that doesn't work. The expectation of self-
service design time for stories is that business users are guided (to some extent also limited) in what they do and can do. The
story design time is supposed to consist of multiple con guration steps that prevent business users from creating something
which breaks. With story design time, we ensure some level of consistency.

It's completely different with applications, especially with the added scripts. As soon as application designers add custom logic
with scripting, they have complete freedom to change the default behavior of the entire analytic application. The design
environment will provide everything to create correct applications, but it doesn't guarantee that the application is correct or won't
break.

In addition, an analytic application has a dedicated life-cycle. You start it and then there are certain steps which are performed, like
the startup event, for example. The story doesn't have that. You can switch the story between edit and view mode as often as
you like.

These are major differences. That is why we offer two artifacts and two corresponding design-time environments to create stories
and analytic applications.

What is the typical workflow in creating an analytic application?


An analytic application is always data-driven. The foundation of an analytic application is one or more underlying SAP Analytics
Cloud models.

As a rst step you decide whether you want to visualize your data in a table or a chart, and add a table or a chart to your analytic
application. This triggers another step for picking a model. In addition to widgets showing data, you add to the layout other
widgets that control data, such as lters, arrange and con gure them, and wire them up.

Almost all widgets expose events. In order to add custom logic to the analytic application, you can implement event handlers with
the help of the scripting language.

What are typical analytic applications?


The variety of analytic applications is really huge. Analytic applications can range from very static visualizations of a few data
points to very advanced, highly customized and interactive applications which offer rich navigation and generic built-in exploration
capabilities. However, there are some patterns of analytic applications:

Table-centric Data Visualization

The application is comprised of a table, which consumes a large extent of the available screen real estate. Around the table,
typically above it, are many UI controls (buttons, checkboxes, dropdown boxes, and so on) to change the data display, such
as to lter the data,change the data view, or show different dimensions. The nature of this application is that there is only
one table, but many and potentially complex ways to show data differently.

Dashboard

The application is a dashboard visualizing a few data points with the help of tiles. There is no interactivity, but it gives users
an overview of highly aggregated data. A typical option of some dashboards is to use the tiles for further drilling into
details: clicking on a tile takes you to a more detailed page or an entirely new application showing more details for the
aggregated number on the tile.

Generic Application

Many applications are created for a speci c model. That means that the UI, the widgets, and the logic are done with
knowledge of the model and its available dimensions, members, and so on. Another category is generic applications. These
are applications which need to be provided with a model whenever the application is executed. These applications are more
complex to create as their logic needs to work with whatever model the end user selects at runtime. The advantage is that
customers don't need to create applications for each and every model they have maintained in their system.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 4/66
8/9/2020

How does scripting work in analytic applications?


Almost all widgets, whether smart, data-related widgets or simple widgets such as buttons and dropdown boxes, expose events.
Even the analytic application itself exposes events such as a startup event or similar. In order to add custom logic to the
application, you can implement event handlers with the help of the scripting language.

 Example
Let's say a dropdown box is populated with the available years in the data model - 2015 to 2019. The dropdown box exposes the
event OnSelect, which is triggered whenever a value is selected from the dropdown box. The implementation of that event
handler could read the selected value and set a lter for the selected year in the model. The numbers shown will re ect the
selected year.

Because you can add many event handlers using the scripting APIs of all widgets and other service APIs offered, the application
can be geared towards the speci c needs of a customer.

What's the scripting language for analytic applications?


The scripting language is JavaScript. Scripts are executed by the Web browser without any transformation. We use the Web
browser's script execution engine, which is available out of the box. In order to offer good tool support for application designers,
we add a type system on top. This is used for the tooling and also for script validation. Let's look at an example:

 Example
Let's say that there is an API method available for ltering members: setFilter("YEAR", "2014"). The plain JavaScript
method expects two strings and this is also what is executed at runtime by the Web browser. However, our de nition of the API
method uses dedicated prede ned types for our problem domain, that is setFilter(Dimension, Member). With that
de nition, the system checks and validates that the passed strings are a valid dimension and a valid member.

The script editor also uses the type information. It doesn't just statically check the types, but uses the knowledge about the
underlying model and provides value help to offer dimensions and members existing in the model.

Creating a New Analytic Application


You can create a new analytic application in a series of short steps.

Procedure
1. To create an analytic application, do one of the following:

From the ( ) Main Menu, select Create Analytic Application .

From the ( ) Main Menu, select Browse Files .

From the Files page, select Create Analytic Application .

2. Choose whether you want to place the widget on the canvas or in the opups area in the Layout tree of the Outline. If you
want to place it in the popup area, select (Add Popup).

3. Choose how you want to visualize your data in the application: You can use charts and/or tables.

Select Insert (Table) from the toolbar to add a table on an existing model. In the Selct Datasource dialog box
you can choose whether you want to add a table based on an existing model or on no model. You can choose an
existing model in the dropdown Select an Existing Modell or just type in the name of a model.

You can choose an existing model in the dropdown Select an Existing Model or just type in the name of a
model. The table is displayed with the corresponding data.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 5/66
8/9/2020
If you choose No Model the table is displayed empty. You can add a data source at a later point in time.

 Note
Once you have chosen an existing model, it will be used as primary default model whenever you add another
table or chart to the analytic application. You can change this data source by choosing (Change primary
model) in the Builder panel.

Select Insert (Chart) from the toolbar to add a chart on an existing model.

4. Add more widgets to your analytic application if needed, for example a dropdown, a lter line, an image, text, or button by
clicking on the button in the Insert menu and choosing a widget.

You can change the style of every widget in the Styling panel by clicking in the canvas right next to the widget on More
Actions Edit Styling .

5. Add scripts to your widgets if you want to enable user interaction with the UI elements at runtime and a custom-speci c
behavior:

a. In the Layout tree hover over the widget name.

b. Click on the button. If the widget supports multiple events, select one of the events and click on the button.

 Note
You can also use the button in the quick action menu of each widget you have placed in your application.

A new tab is automatically created in the script editor, where you can add scripts for the widget.

c. Close the tab by clicking on the button at the right of the tab.

6. Select (Save) to save your analytic application.

a. Specify the analytic application's path – you can save to your private les or to a public path.

 Note
A public analytic application is visible to all users. A private analytic application is visible to its creator and the
users they have chosen to share it with.

b. Provide a unique name for your analytic application.

 Note
Valid characters are alphanumeric characters and underscores. Spaces can be included but not at the start or
end of a name.

c. Provide an optional description.

Whenever you change your analytic application, you have to save your changes rst to see them at runtime.

7. Click on Run Analytic Application in the upper right corner of the Web browser window. The application opens in another
Web browser window.

Related Information
Creating a Table
Creating a Chart
Widget Reference
Analytics Designer API Reference
Using the Script Editor
Managing Analytic Applications

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 6/66
8/9/2020

Changing the Name of Widgets


You can change the name of each widget.

Context
When you add widgets to the main canvas, the system automatically creates names for the widgets that are displayed in the
Outline. The name of a widget is important if you write scripts that refer to or address it. You can change the default widget name
and adjust it to your needs in the Anaytics Designer Properties area of the Styling tool. The change will also be re ected in the
Outline/Layoutand anywhere you use the widget.

Procedure
1. Insert a widget to the canvas or popups area in the Layout by clicking (Table), (Chart) or by clicking the (Add)
button in the toolbar.

The widget is displayed on the main canvas and its default name is shown in the Outline view.

 Note
You can move a widget up and down within the Layout view via dragging and dropping. The widget listed higher will take
precedence over the ones below when displayed in the Canvas or Popups area.

2. Click Designer to open the Builder and Styling panel.

3. Click (Styling) to change the name.

4. Change the name in the Analytics Designer Properties area.

The new name is updated and displayed in the Layout.

Aligning Widgets
As an application designer, you can align the position of multiple widgets when designing an application to improve your work
efficiency and design accuracy.

To align widgets, rst select all the widgets that you want to reposition. Then, in the quick menu to the right of the selected area,
click the (Align Widgets) icon and select one of the following options from the quick menu according to your needs:

Align Left: align the left edge of each selected widgets to the leftmost edge of all selected widgets.

Align Right: align the right edge of each selected widgets to the rightmost edge of all selected widgets.

Align Top: align the top edge of each selected widgets to the topmost edge of all selected widgets

Align Bottom: align the bottom edge of each selected widgets to the bottommost edge of all selected widgets.

Align Middle: center the selected widgets horizontally by aligning their vertical center axis.

Align Center: center the selected widgets vertically by aligning their horizontal center axis.

Distribute Horizontally: make the selected widgets equidistantly in horizontal direction.

Distribute Vertically: make the selected widgets equidistantly in vertical direction.

 Note
The height or width of the widget will not change whether you de ne it as auto, pixel or percentage values.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 7/66
8/9/2020

You can de ne the left, right, top or bottom margin of the widgets as auto, pixel or percentage values too. However, when you align
widgets, such settings of the widgets' position may change under different conditions. Take aligning widgets to the leftmost edge
as an example:

If the left margins of one or more widgets are de ned as pixel, or if the left margins of all widgets are de ned as auto, after
you align the left edges, the unit of the left margins of all widgets will be changed to pixel.

If no widget’s left margin is de ned as pixel and the left margins of one or more widgets are de ned as percentage, after
you align the left edges, the unit of the left margins of all the widgets will be changed to percentage.

This rule applies the same when you align widgets to right, top and bottom.

Adding Comments to Widgets and Table


Cells
Commenting is available in both stories and analytic applications. Only the usage speci c to the analytics designer is described
here.

You can view and create comments on a widget or a table cell from planning models.

Widgets that you can add comments to include:

chart

table

geo map

image

shape

text

RSS reader

web page

R visualization

clock

 Note
To enable or disable the comment option in the quick menu of a widget, you can go to the Quick Menus section of the widget's
Styling panel, then select or deselect the option Comment.

 Note
If you create a story from an analytic application, comments in the application won’t be carried to the created story.

Show or Hide Comments


https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 8/66
8/9/2020
When running an analytic application, in the view mode, you can directly show or hide all comments by clicking the ( Comment
Mode) icon in the toolbar. In the embed mode, you need to rst enable the option Commenting in Embedded Mode via
System Administration System Configuration , then you can leverage the following API to show or hide comments:

 Code Syntax
Application.setCommentModeEnabled(isEnabled:bool)

Get, Post, Remove Table Cell Comments


In addition to directly creating or removing comments in an analytic application as in a story, you can leverage corresponding
scripts APIs to get, post, remove comments on a table cell either based on comment IDs or the data context.

All the comments added are also displayed in the Comments view of the Collaboration panel. But currently there's a
limitation that even if you hide a widget, all comments related to the widget will still be displayed in the Collaboration panel.

 Example
For example, you’ve designed an input eld (InputField_1) and would like to allow end users to:

1. Click a button (Button_1) and get the comment created on one cell and input it into the input eld.

2. Click another button (Button_2) and post the comment in the input eld to any table cell they select.

First write the following script for Button_1:

 Sample Code
var comments = Table_1.getDataSource().getComments().getAllComments(Table_1.getSelections()[0]);
console.log(comments);
var str = "";
for(var i = 0 ; i < comments.length; i ++){
var text = comments[i].text;
str = str + txt;
}
InputField_1.setValue(str);

Then write the following script for Button_2:

 Sample Code
var str = InputField_1.getValue();
Table_1.getDataSource().getComments().addComment(Table_1.getSelections()[0],str);

Related Information
Adding Comments to a Data Cell

Copying and Pasting Widgets and Scripting


Objects
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916e… 9/66
8/9/2020
You can copy and paste widgets together with corresponding scripts, as well as scripting objects together with functions within a
single application or from one application to another.

Prerequisites
You have created an analytic application with widgets that contain scripts, or you have created scripting objects such as script
variables, script objects and OData services. Now you want to use one or more of these widgets or scripting objects with the
corresponding scripts in another application or even within the same application.

Context
The procedures of copying and pasting widgets and scripting objects are identical. In the procedure below, we will take widgets as
an example.

Procedure
1. Select the widget you want to reuse in the main canvas and click Copy on the short menu on the right side of the
widget.

2. Decide whether you want to use the widget/script within the same application or in another.

3. To reuse the widget/script within the same application, proceed as follows:

a. Choose Duplicate in the copy short menu.

The widget is automatically added to the main canvas.

Alternatively, you can use the copy/paste function:

i. Choose Copy in the copy short menu.

ii. Click in the main canvas where you want to paste the widget.

iii. Click Copy and Paste in the le menu and select Paste. The widget is added to the place you clicked to
insert it.

4. If you want to reuse the widget/script in another application, proceed as follows:

a. Choose Copy in the copy short menu.

b. Close current application.

c. In the same browser tab page, open the application where you want to reuse the copied widget.

 Note
Noted that currently you cannot paste copied widgets or scripting objects to application opened in a new
window or tab page.

d. Click on the main canvas where you want to paste the widget.

e. Click Copy and Paste in the le menu and select Paste.

The widget is added to the place you clicked to insert it.

 Note
Once you have clicked Copy and Paste in the le menu you can also use the keyboard shortcuts CTRL + C
and CTRL + V .

Results

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 10/66
8/9/2020
You can see that the assigned script has been copied from one widget to the pasted widget: the fx button next to the pasted
widget name in the outline of the analytic application is already active. Click on the fx button to see the copied script.

Copying and Pasting Widgets from Story to


Analytic Application
You can copy one or several supported story widgets to an analytic application in the same browser page.

Context
You can only copy widgets from a story to an analytic application, but not the other way around, from an analytic application to a
story.

The places where you can copy widgets to can be the canvas, pop up or a widget container such as a panel or a tab page. You can
directly copy a chart or a table widget, or a chart or a table in the Smart Insight panel and the Examine panel to an analytic
application.

After successfully copying the widget, the state of the widgets, for example the lter, hierarchy, ranking and sorting states and so
on will look exactly like that in story, also all relevant settings such as the data binding, necessary variables and styling settings
and the other properties will be kept.

 Note
Unsupported widgets and features:

Some story widgets which are not yet supported in analytic application, such as value driver tree and input control
won’t be pasted to the target analytic application.

Some story’s features which are not yet supported in analytic application, such as link analysis and dynamic image
won’t be copied to the application.

Other limitations:

The status of some speci c types of story lters, such as geo polygon lter and panning or zooming won't be copied to
the application.

When copying grouped widgets, all widgets will be copied to the application. However, the grouping information won’t
be copied.

Thresholds and colors assigned to a table or chart won't be copied to the application.

Chart or table with link dimensions won't be copied to the application.

Data cell level comments will be copied to the application. However, widget-based comments won't.

If a story table’s dynamic text is referenced to other resource outside the copying scope, the dynamic text won't be
copied to the application.

Hyperlinks won’t be copied along with a widget if its type is not External Hyperlink.

Procedure
You can copy a widget either via Ctrl + C and Ctrl + V or follow the steps below:

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 11/66
8/9/2020
1. In the story, select the widget or a group of widgets you want to copy.

2. Click the (More Actions) beside the widget, in the quick menu choose Copy.

3. Exit the story and go to the analytic application you want to copy the widget to.

4. Focus your mouse on the place where you want to copy the widget to, for example the canvas, popup or container widget.

5. From the tool bar, click the button (Copy and Paste) and choose Paste.

The widget will be pasted to the selected place.

Restoring Deleted Widgets or Scripting


Objects
You can restore the latest deleted widget or scripting object when designing an analytic application.

When you delete one or more widgets or scripting objects at one time, a Restore option will be displayed in the con rmation
dialog as below:

Click this restore option and the items you delete just now will be restored. Noted that only the widgets or scripting objects
deleted in last operation will be restored.

After you restore a widget, all its previous state, including ID, measure and dimension binding, lters, order and settings will be
kept, as well as the lter line bond to it. However, the position of the widget in the canvas or popup won't be kept.

And the system will try to keep the previous name of the widget or scripting object if the name hasn't been occupied elsewhere. If
the item name is occupied and will be changed, an information dialog will inform you of such changes.

 Note
Restoring the deletion of a popup is currently not supported.

For singleton objects such as Bookmark and Export to PDF, if you add a same object right after the deletion, the previous one
won't be restored.

Creating an Analytic Application based on an


SAP Data Warehouse Cloud Space
You can create an analytic application based on an SAP Data Warehouse Cloud (DWC) space in SAP Analytics Cloud.

Prerequisites
Please assure that the following conditions are made:

To use SAP Analytics Cloud within the context of a SAP Data Warehouse Cloud space (Space Aware Connectivity), SAP
Data Warehouse Cloud and SAP Analytics Cloud need to be on the same tenant.

Context

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 12/66
8/9/2020

Procedure
1. In the Main Menu select Browse Files .

2. Under Spaces select a space, other than Analytics Cloud.

3. In the menu bar select Create Analytic Application .

4. Choose a model-based widget like table or chart.

5. Choose the data set you would like to work with and choseOK.

6. Create the analytic application according to our needs.

7. Save the analytic application.

8. Click on Run Analytic Application in the upper right corner of the Web browser window. The application opens in another
Web browser window.

Using the Script Editor


Using the script editor lets you write scripts for each widget and thus create interactive and highly custom-de ned analytic
applications. To enable interactivity, you con gure the behavior of widgets and write widget scripts that are executed when the
user performs an action in the executed application. For example, you can place the Button widget in the application and assign a
script to the Button’s onClick event. You can also write scripts that are based on other system events like the onInit event of the
application or scripts that are executed whenever data is changed.

Context
Scripts consist of one or more statements written in a JavaScript-based language that follow a speci c syntax. You write scripts in
the script editor. You can nd all objects, elds and functions available in scripts in the Analytics Designer API Reference on SAP
Help Portal at Analytics Designer API Reference.

Procedure
1. Add a widget to the canvas, for example a dropdown.

The speci c icon and name of the application is displayed in the Outline.

2. Hover the mouse over the widget name.

An button is displayed right next to the widget name.

3. Click on the button. If the widget supports multiple events, select one of the events and click on the button.

 Note
You can also use the button in the quick action menu of each widget you have placed in your application.

The script editor opens in a new tab which displays the name of the event (example: "onSelect") and the widget or
application to which the script will be assigned (example: "table_1 - onSelect").

4. Type in one or more statements with this syntax: <ComponentVariable>.<function>(<arguments>);.

 Tip
You can activate the content assistance at any place in the script by pressing CTRL + + + Space on your keyboard.

5. You can change the order of the tabs by dragging and dropping a tab horizontally.

6. When you have nished your script, close the tab by clicking on the button at the right of the tab.

To reopen the script editor, again click the button next to the widget in the Outline.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 13/66
8/9/2020

Related Information
Adding a Script to a Widget
Using Script Variables
Using Popups
Analytics Designer API Reference
Known Limitations to Analytics Designer
Using the Value Help in the Script Editor
About Script Objects
Creating a New Script Object and Script Function
Modifying And Deleting Script Objects and Script Functions

Adding a Script to a Widget


You can write event handlers for widgets and other events to create interactive applications with custom-de ned behavior.

Procedure
1. Add a widget to the canvas, for example a dropdown.

The speci c icon and name of the application are displayed in the Outline.

2. Hover the mouse over the widget name.

A button is displayed right next to the widget name.

3. Click on the button. If the widget supports multiple events, select one of the events and click on the button.

 Note
You can also use the button in the quick action menu of each widget you have placed in your application.

A new tab is automatically created in the script editor, where you can add scripts for the widget. For example, the following
code gets the selected text of a dropdown:

 Sample Code
var selectedText = Dropdown_1.getSelectedText();

You can nd all objects, elds and functions available in scripts in the Analytics Designer API Reference on SAP Help Portal
at Analytics Designer API Reference.

4. Drag and drop a tab horizontally to change its display order if needed.

5. Close the tab by clicking on the button at the right of the tab.

Related Information
Using Script Variables

Using the Value Help in the Script Editor


You can use different value help dialog boxes depending on the context in which you're working in the script editor.

 Note

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 14/66
8/9/2020
setVariableValue, for tables and charts, and addMeasure, for charts, only support single variable values. That's why the
member selector also allows only single selection.

Value Help Dialog for Measures


To get measure metadata in the script editor, press CTRL + SPACE .

 Note
This value help dialog is only available for the chart function chart.addmeasure().

Value Help Dialog for Measures

The member selector for metadata is displayed like this:

Member Selector for Metadata

The result of metadata selection is displayed like this in the script editor:

Selection Result displayed in the Script Editor

Value Help Dialog for Variable Values


To get metadata for variable values, press CTRL + Space . If you are working with a dimension variable, you can open the
member selector; otherwise you can only add or show the variable values in the code completion list.

Dimension Variable Cases

The member selector for dimension variables is displayed like this:

Dimension Variable: Member Selector

The selection result is displayed like this:

Dimension Variable: Selection Result in Script Editor

If you work with a variable that is not a dimension, the value help is displayed in the following way:

None Dimension Variable

And the selection result in the script editor looks like this:

Selection Result for None Dimension Variable in Script Editor

Using the Value Help for the Selection


Object
If a function needs a selection object as an argument, you can see available arguments by pressing CTRL + space .

This provides value help for the keys, which represent the dimensions of an associated data source, or for the values of keys, which
represent a dimension member of the corresponding key/dimension.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 15/66
8/9/2020

 Note
To start the selection object you have to type in braces {} within the parentheses ( ).

Value Help Number 1 for Object Key/Dimension

Value Help Number 2 for Object Key/Dimension

Value Help for Object Value/Dimension Member

Value Help for Member Expression/Binary Expression/ Assignment Expression


If you have a selection object like sel in the following examples, you can get value help for dimensions of an associated data source
when you try to access its properties by pressing CTRL + space after the dot operator.

You can also get value help for the corresponding dimension members of the dimension property when you try to assign or
compare the property.

Value Help for Property/Member Access/Dimension

Value Help for Binary Expression/Dimension Member

Value Help for Assignment Expression/Dimension Member

Using Keyboard Shortcuts in the Script


Editor
When you work in the script editor, you can use keyboard shortcuts to simplify your work.

The following keyboard shortcuts are available in the script editor:

Command Keyboard Shortcut Description

selectAll CTRL + A Select the whole content of the editor.

deleteLine CTRL + D Delete the whole line under the cursor,


including newline at the end.

saveApplication CTRL + S Save the whole application.

singleSelection ESC When multiple selections are present, this


deselects all but the primary selection.

undo CTRL + Z Undo the last change.

redo CTRL + Y Redo the last undone change.

undoSelection CTRL + U Undo the last change to the selection, or if


there are no selection-only changes at the
top of the history, undo the last change.

redoSelection ALT + U Redo the last change to the selection, or the


last text change if no selection changes
remain.

goDocStart CTRL + Home Move the cursor to the start of the


document.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 16/66
8/9/2020

Command Keyboard Shortcut Description

goDocEnd CTRL + End Move the cursor to the end of the document.

goLineStart ALT + Left Move the cursor to the start of the line.

goLineStartSmart Home Move to the start of the text on the line, or if


we are already there, to the actual start of
the line (including whitespace).

goLineEnd ALT + Right Move the cursor to the end of the line.

goGroupLeft CTRL + Left Move to the left of the group before the
cursor. A group is a stretch of word
characters, a stretch of punctuation
characters, a newline, or a stretch of more
than one whitespace character.

goGroupRight CTRL + Right Move to the right of the group after the
cursor. A group is a stretch of word
characters, a stretch of punctuation
characters, a newline, or a stretch of more
than one whitespace character.

delCharBefore SHIFT + Backspace Delete the character before the cursor.

delCharAfter Delete Delete the character after the cursor.

delGroupBefore CTRL + Backspace Delete to the left of the group before the
cursor.

delGroupAfter CTRL + Delete Delete to the start of the group after the
cursor.

indentAuto SHIFT + Tab Auto-indent the current line or selection.

nd CTRL + F Find.

ndNext CTRL + G Find next.

ndPrev SHIFT + CTLR + G Find previous.

toggleComments CTRL + # (Microsoft Windows), CMD + Toggles between commenting and


/ (Mac OS) uncommenting the selected lines.

Using Script Variables


Script variables are reusable elements that store a value of a certain type.

You use script variables in scripts. They are useful, for example, for storing intermediate results that are used repeatedly in a
script.

Script variables exist during the full execution time of the analytical application. The script variables you create in an application
are only available for that speci c application. You can de ne their values not only in the application, but also in the application
URL by adding a speci c URL parameter.

For each script variable, you can de ne a name, an optional description, the type, and a default value (which is optional and
depends on the variable type). A script variable can be de ned as an array, which means it represents a set of values of the
speci ed type. You can use the following primitive types by opening the Type list:

string

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 17/66
8/9/2020
represents a text as a sequence of characters

boolean

represents a logical value, either true or false

integer

represents a non-fractional numerical value

Scienti c notation is not supported when you enter an integer. But when running an analytic application, the number will
be displayed in scienti c notation format if it is longer than 21 digits.

number

represents a oating-point numerical value

Can be entered in ordinary format or scienti c notation format such as "1e+20" or "1e20". If the number is longer than 21
digits, it will be automatically displayed in scienti c notation format.

In addition to the primitive types described above, you can select a wider variety of non-primitive types for the script variable from
the Type list, such as Button, Category, Chart, Clock, DataSource, Table, and so on.

Creating a Script Variable


1. In the Scripting area of the Layout, click right next to Script Variables to create a new script variable.

Its icon and name are displayed beneath Script Variables and a new dialog, Script Variable, is opened.

2. In the dialog, you can change the name of the script variable.

3. (Optional)

Type in a description for the script variable.

4. Select the type of the script variable and whether it should be set as an array.

5. Specify the default value depending on the type.

6. Choose Done to close the script variable.

7. You can now use the script variable in the scripts within this application.

Defining a Script Variable's Value via a URL Parameter


1. Choose the script variable you want to de ne, and go to the Scipt Variable dialog.

2. In the dialog, select the option Expose Variable via URL Parameter.

 Note
For array type variables and non-primitive type variables (types other than string, boolean, integer and number), this
function is not applicable and the option is disabled by default.

3. Save the change to the analytic application and choose Run Analytic Application.

4. In the URL of the analytic application, enter a new parameter that starts with "p_" and is followed by the script variable's
name.

For example, if you want to set the value of ScriptVariable_1 to 3.14, add the following information to the original URL:

;p_ScriptVariable_1=3.14

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 18/66
8/9/2020
5. Reopen your application URL.

You will see the URL parameter value has been passed to corresponding script variables. In this way, you can initialize the
application based on your needs by simply making some changes to the URL parameters.

Using a Script Variable


You can use a script variable like a local variable in your script. For example, you change the value by assigning a new value and use
this value by passing it as argument when calling a function.

If you write scripts in the application, you can insert the script variable you have created by selecting it from the content
assistance in the script editor. You can activate the content assistance at any place in the script by pressing CTRL + + +
Space on your keyboard.

If you add a calculation to a dimension or measure, in the Calculation Editor you can insert the script variable you have created by
typing @ in the formula. All available script variables will be automatically displayed in the drop-down list. Note that only global
variables of type string, integer, and number can be referenced in the Calculation Editor. The array type is not supported.

 Note
When you use the script variable as the judging expression in a IF instruction, and the expression returns a null value, the IF
instruction will also return a null result. For example, if you write a script like this:

if (ScriptVariable_1 = "xxx"; 100 ; -100)

And you set the script variable to unde ned when running the analytic application, the data returned and displayed in the chart
is not -100, but null.

You can also de ne script variables as the source of dynamic text in a text widget. For detailed information about this, refer to Text.

Changing or Deleting a Script Variable


To change an existing scripting variable, click it in the Outline view. The dialog where you can make your changes is displayed
again.

To delete an existing scripting variable, choose More Actions beside the script variable in the Outline view, and select Delete.

After deleting a script variable, you can add it again to the analytic application with the same variable name. If the type of the
script variable is number or integer and was previously used in a calculated measure, the calculated data won't resume
automatically. You need to go back to the calculated measures in the Builder panel and from the More Actions menu, select
Edit Calculation. Then click OK again. After that, corresponding calculated data will resume in the analytic application.

About Script Objects


A script object is a non-visible part of an analytic application which groups a set of functions.

As an application designer you can use a function to encapsulate certain script logic that can be used in other script functions like
event handlers. This keeps you from duplicating code and makes maintenance of applications easier.

Once you have added a script object you can create functions on this object, which will be exposed as script functions. Each script
function has the following elements:

a con gurable name

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 19/66
8/9/2020
return type

any number of typed arguments

You can access the script object in scripts with its name like other widgets. Inside a function of the script object you have access to
all objects in the application such as widgets, global variables, or popups.

Related Information
Creating a New Script Object and Script Function
Modifying And Deleting Script Objects and Script Functions

Creating a New Script Object and Script


Function
To be able to create and use script functions, you rst have to create a script object.

Procedure
1. To create a new script object, click the button in the Script Objects section in the Scripting area of the Layout in design
mode.

The new script object is displayed in this section. It can be renamed from the (More) menu or by double-clicking the
name as for widgets.

2. To create a new script function, click (More) for the script object and choose Add Script Function.

A new function is created and can be seen underneath the script object instance. The side panel for this new function is
displayed too. Here you can modify the function name, description, arguments, and the type of return value. Click Done to
close the side panel.

3. Edit the script function in the script function dialog.

In the Properties section, type in the following elements:

Element Description

Name of the function The name is mandatory and it validates according to the same
rules as for global variables (name cannot be empty, cannot be
a reserved keyword, cannot begin with a letter).

Description of the function A brief description.

Return Type of the function Can be void, string, boolean, integer, number.

By default, the return type is set to Void. However, you can


change this.

Besides the primitive types described above, you can also select
a wide variety non-primitive types in the dropdown box like
Button, Category, Chart, Clock, DataSource, Table, UrlType etc.

Set as Array Only activated if the return type is not void.

Click to create a new argument for the function. The argument dialog is displayed, where you can edit the following
elements:

Name of the argument

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 20/66
8/9/2020
Type of the argument

By default, the arguments panel is automatically completed with a suggested argument name.. If the argument should
represent a list of this type, set it to be an array.

To close the argument panel and return to the script function side panel, click Done.

 Note
All modi cations take effect immediately without your having to click Done, for example when you press enter on an
input, or immediately after you switch the dropdown value or to an array. You can see the resulting signature in the
signature panel at the top of the editor and in the script function panel in the Arguments section.

4. Optional: You can reorder the arguments by dragging and dropping them inside the panel.

This changes the order of the arguments in the de ned function.

Example
The following example describes the return type and input parameters for the script function computeAverage.

Name: computeAverage

Return Type: number

Arguments: value1, value2 and value3 (all of type number)

Script code: return (value1 + value2 + value3) / 3.0;

Related Information
Creating a New Script Object and Script Function

Modifying And Deleting Script Objects and


Script Functions
You can modify and delete existing script objects and script functions according to your needs.

Modifying Script Functions


To implement the script function, you can open the editor for the script function by clicking the button next to the script
function in the Scripting area of the Outline. You can use any other instructions you can use in widget event handlers.

To change the name, description, arguments, and return type, click the function in the Scriptingarea of the Outline. It will open the
side panel for this script function where you can do your changes. After you have changed the function, click Done to close the
panel..

To edit arguments, click (Edit) next to the corresponding argument in the arguments section in the script function side panel.
To remove an argument, click (Remove) next to the argument.

Deleting Script Objects and Script Functions


To delete a script object or script function, click (More) next to the corresponding script object or script function and choose
Delete.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 21/66
8/9/2020

Related Information
Creating a New Script Object and Script Function

Using Timer
Timer object enables application designers to start a timer to trigger timing events.

By leveraging the feature of a timer, you can realize different scenarios such as:

create simple animations that allow image or text widgets to change their content every couple of seconds.

send noti cations to end users in a certain interval of time.

refresh your analytic application in a certain interval of time.

Multiple timers can exist simultaneously, but each timer works independently from others.

Creating a Timer
1. In the Scripting section of the Outline, select right next to Timer to create a timer.

2. The side panel Timer opens with a default name Timer_1 displayed. You can change the name at will.

3. Click Done to nish creating the timer.

4. To invoke the timer, write the script Timer_1.start(delayInSeconds: number) for the triggering event of the
canvas or a widget. For example, if you want to invoke the timer when clicking a button, write the script for the onClick()
event of the button.

 Note
When calling the start() API on a timer that is already running, it will override the rst start() API, that is, the
timer stops and immediately restarts to realize the delay set by the second start() API.

 Note
The delay time set in the timer can be both a integer that's measured by seconds, or a decimal that's measured by a
smaller unit. For example, if you write start(0.1), then the delay time will be 100 milliseconds.

5. To repeatedly restart a timer once it’s time out, you can go to its onTimeout() event and write the script
Timer_1.start(delayInSeconds: number).

There are some other script APIs available for the onTimeout() event of a timer, such as Timer_1.stop() and
Timer_1.isRunning(). For detailed information, refer to Analytics Designer API Reference.

 Example
Here is an example of leveraging the timer to automatically scroll some images horizontally from right to left in a certain
interval.

First, add three different images (Image_1, Image_2 and Image_3) and place them side by side in the canvas. Take notes of
their left margins, which are 112, 240 and 368 px.

Then add an image type script variable (Animation_Widgets) and an integer type script variable (LeftMargins). Enable the Set
As Array option for the two script variables.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 22/66
8/9/2020
After that, add a script object (Util_Animation) with a function (doAnimation) and then add a timer (Timer_1) .

Write the following scripts:

For the onInitialization event of canvas:

 Sample Code
console.log('onInitialization - begin');

LeftMargins = [112, 240, 368];


Animation_Widgets = [Image_1,Image_2,Image_3];

//Start the timer after 3 seconds after initializing the canvas.


Timer_1.start(3);

console.log('onInitialization - end');

For doAnimation:

 Sample Code
var num = 3;

//LeftMargins = [112, 240, 368];

//Redefine the sequence of the images.


var first = Animation_Widgets[0];
Animation_Widgets[0] = Animation_Widgets[1];
Animation_Widgets[1] = Animation_Widgets[2];
Animation_Widgets[2] = first;

// update the left margin of each widgets.


for(var i=0;i<num;i++) {
Animation_Widgets[i].getLayout().setLeft(LeftMargins[i]);
}

For Timer_1:

 Sample Code
//Run this script object once Timer_1 is time out.
Util_Animation.doAnimation();

//Restart Timer_1 again after 3 seconds.


Timer_1.start(3);

After you save the application and choose Run Analytic Application, application users can see the images automatically scroll
from right to left in turn as expected.

Working with Line Breaks in Text Widgets


https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 23/66
8/9/2020
You can force line breaks while using the applyText() API of the text widget.

The line breaks you've set will be kept if you use the API getPlainText().

Usage
In the script editor, you can use \n as control character to force a line break in a text widget via the widget's API applyText().

 Example
Let's assume you use a button and a text widget in your application. When the user clicks on the button at runtime, a new text
line is displayed in the text widget, saying This is a new paragraph.. To achieve this, type in the following script in the button's
onClick event:

 Sample Code
var currentText = Text_1.getPlainText();
Text_1.applyText(currentText + "\nThis is a new paragraph.");

This line of script will change the text widget's content.

Before:

After:

Correction of Calculation Handling in Script


APIs with SAP Analytics Cloud 2019.18
With version 2019.18, we’ve changed the calculation handling in script APIs. Due to this change, you need to adjust your existing
analytic applications that use calculations on the account dimension. Learn how to apply the changes and make your applications
run again.

Prior to SAP Analytics Cloud 2019.18, calculations on the account dimension were not handled properly by script APIs such as
setDimensionFilter or getData on the DataSource type.

In addition, the value help returned incorrect member identi ers. Prior to the change, member IDs would look like this:
[Account_BestRunJ_sold].[parentId].&C4A#CALC0. After the change, the member identi ers are GUIDs and look
like this 25880968-9230-4045-b252-417449111942. As of version 2019.18, all script methods accepting or returning
member IDs use the new member IDs (GUID format) only. If you have used a hard-coded member ID of such a calculation in your
application, you need to change it to the correct format.

Steps Required After the Update to Version 2019.18.


1. In your application, choose the appropriate widget and choose Edit Scripts.

2. Adjust the script where calculated measures are used, for example for the API method addMeasure, by replacing the old
calculation measure ID with new one: In the script editor, click Ctrl + Space and select the calculated measure with the
new ID.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 24/66
8/9/2020

 Example
Old calculated measure ID prior to version 2019.18:

 Sample Code
Chart_1.addMeasure("[Account].[parentId].&[C4A#CALC0]",Feed.ValueAxis);

New calculated measure ID as of version 2019.18:

 Sample Code
Chart_1.addMeasure("16387401-6533-4893-9825-833760248992", Feed.ValueAxis);

Optimizing Type Libraries


With SAP Analytics Cloud Analytics Designer vesion 2020.2 only types available in the standard library are suggested when you
create an new analytic application and call the content assistance in the script editor by clicking Ctrl + Space . Prior to this
version all type libraries have been displayed which could decrease the runtime performance.

Once you add a widget or a technical object to the application, the associated type library is displayed as well. If you remove the
last widget or technical object associated with a type library, the library is also removed and not displayed any longer in the
content assistance.

Optimization of applications created prior to version 2020.2


For applications created prior to version 2020.2, you can start the optimization manually:

1. Open the application in analytics designer.

2. Choose Settings Optimize Type Libraries . A dialog Optimize Script Libraries is displayed that informs you that you can
optimize the script type library in favor of design time scripting experience and the run time performance. With this
optimization only script types which are related to the widgets in your application will be available.

3. Click Optimize in the dialog. The type libraries will be cleaned up immediately. All scripts will immediately be checked and
any errors will be shown in the error list.

 Note
If you have already used some type libraries that are not directly related to objects (like widgets) used in the application
(for example, you have used Feed enum values in scripts in the application that contains no charts), this could lead to
scripting errors. Please check the error list after the optimization and update your scripts as needed.

4. To nish the optimization process, save the application.

 Note
If you don't save the application, it will behave as before.

For further information about the various type libraries, please refer to the Analytics Designer API Reference on SAP Help Portal at
Analytics Designer API Reference

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 25/66
8/9/2020

Working with Automatic Refactoring


Analytics Designer has a concept of names for widgets and other application entities to ease the handling effort at design time.

If you as an application designer want to rename some entity, various references to it have to be adapted (mainly scripts, dynamic
texts, and calculated measures). Previously, you had to do this work manually, which is a tedious job, especially for larger
applications.

The new automatic refactoring automates this process as much as possible. Ideally, you don't need to do anything: the rename
just works, keeping the application intact.

However, there are cases where blindly executing the rename would result in script errors. In such cases you'll be informed upfront
about any issues, and you can decide to either cancel the rename operation or continue.

When you rename an application entity (either by using the Outline view or by changing the name in the side panel / styling panel),
the software behaves as follows:

All scripts (both event handlers and script functions) without script errors will be adapted automatically.

 Note
If the script declares a local variable with the same name as the new name speci ed during the rename operation, the
local variable will be automatically renamed, using the pattern <oldName>_$.

Example: The script declares var OkButton = Button_1;, and now you rename Button_1 to OkButton. Then the
script will be changed to var OkButton_$ = OkButton;

If the renamed entity is a script variable, two additional refactorings will be done automatically:

All dynamic texts that reference the script variable will be adapted to use the new name.

All calculations that reference the script variable (which in this case has to be of type number or integer) will be
adapted to use the new name.

In the following special cases, you have to interact with the system:

Special Case/System Response Options

If the renamed entity is a script variable which is exposed via URL You can continue or cancel the refactoring.
parameter, a con rmation dialog will pop up to say this might break
links to this application (those links that set the script variable via
URL parameter).

If occurrences of the renamed entity have been found in scripts You can continue or cancel the refactoring.
which have script errors, a con rmation dialog will pop up to say
scripts with errors will be skipped, and that you'll have to manually
adapt the script.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 26/66
8/9/2020

Special Case/System Response Options

If occurrences of the renamed entity have been found in a script that You can continue or cancel the refactoring.
has (read-only) input parameters which con ict with the new name,
a con rmation dialog will pop up to inform you that the script will be
skipped, and that you'll have to manually adapt it.

 Example
The event handler for onPostMessageReceived has two event
parameters, message and origin. The script has an
occurrence of some application entity that should now be
renamed to message. This con icts with the event parameter,
and this con ict can't be resolved. Note that the same example
can also be applied to script functions, where the new name
con icts with a script function argument name.

If scripts use a built-in object (like console, ArrayUtils, You can continue or cancel the refactoring.
MemberDisplayMode) which con icts with the new name, a
con rmation dialog will pop up to inform you that the scripts will be
skipped, and that you'll have to manually adapt them.

 Note
In this case the scripts do not need to contain a reference to the
renamed entity.

Debugging Scripts
To nd errors in your scripts, you can use the Web browser’s development tools to set breakpoints, or use the analytics designer
debug mode.

Debugging Scripts

Debugging Tasks More Information

Before you start debugging your scripts, learn how to nd and view Finding Your Scripts in the Web Browser's Development Tools
them in the development tools of the Web browser (Google
Chrome).

To pause a script while it is executed, you can set breakpoints at Setting Breakpoints in Your Scripts
certain points in your script.

Launch the analytics designer debug mode and use the debugger; Using the Analytics Designer Debug Mode
statement in your scripts.

Finding Your Scripts in the Web Browser's


Development Tools
Before you start debugging your scripts, learn how to nd and view them in the development tools of the Web browser (Google
Chrome).

To nd an authored script in the Web browser's development tools, you need to run the script at least once during the current
session.

 Note

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 27/66
8/9/2020
Before executing your scripts in the runtime, the analytics designer transforms them. This is why the JavaScript in the Web
browser's development tools doesn't look exactly the same as the scripts you wrote in the script editor during design time.

Viewing The Scripts in Your Analytic Application


To view the scripts you wrote in your analytic application, just run the application and press F12 , which opens the Web browser's
development tools.

Finding Scripts By Searching For Script Names


To search for a script by its name, press F12 to open the development tools and press Ctrl + P to open the search eld. Enter
the name of the script to search for.

The names of the scripts follow a speci c scheme: <WIDGET_NAME>.<FUNCTION_NAME>.js. The scripts are grouped in a
folder named <APPLICATION_NAME> where the components of the scripts' names have the following meaning:

Components of Script Names

Key Description

APPLICATION_NAME the name that you set for your application when you saved it

WIDGET_NAME the name of the widget/element in your application

FUNCTION_NAME the name of the function/event handler that holds the script you
wrote

If you de ned a script for the onInitialization event of your application, the WIDGET_NAME will be automatically set to
"Application".

 Note
Special characters in your application name will be replaced by "_", except "-" and "." which will be kept as they are.

 Example
Let's assume you have an application called "My Demo Application" that contains a button called "Button_1" with an onClick
event handler. The name of the script would be Button_1.onClick.js and it would be located in a folder called
My_Demo_Application.

Finding Scripts By Browsing the File Tree


To nd a script by using the le tree on the left side of the development tools, press F12 to open the development tools and
select the Sources tab. On the top level of the le tree, search for the entry that starts with sandbox.worker.main. Under
AnalyticApplication, you'll nd the folder with your application's name. You'll nd the scripts that you've already executed for your
current application in this folder.

Setting Breakpoints in Your Scripts


To pause a script while it is running, you can set breakpoints at certain points in your script.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 28/66
8/9/2020

Procedure
1. Open the script you want to pause during its execution and, on the left side of the opened script in the development tools,
click the line number where you want the script to pause.

A blue marker appears that highlights the line number. This indicates that the script will be paused here the next time it is
executed.

2. Optional: Add more breakpoints in the same script to pause the script at different points during its runtime.

Next Steps
To reset a breakpoint, just click on the marker you want to remove and the script's execution won't stop at this point the next time
the script runs.

Using the Analytics Designer Debug Mode


The analytics designer debug mode lets you set automatic breakpoints by using a speci c statement, and it generates your script
comments into the transformed JavaScript displayed in the Web browser's development tools.

Launching the Debug Mode


You activate the debug mode by adding the URL parameter debug=true to your analytic application.

 Note
If the debug parameter receives a different value than true or no value at all, it's ignored and the debug mode isn't enabled.

A valid URL of an analytic application at runtime with enabled debug mode looks like this: http://<HOST>:
<PORT>/sap/fpa/ui/app.html?tenant=<TENANT_NAME>#;mode=present;view_id=appBuilding;appId=
<APPLICATION_ID>;debug=true

 Note
The names of the scripts are generated differently when the analytic application runs in debug mode. In debug mode, all script
names receive the suffix -dbg. For example: Button_1.onClick-dbg.js

Using the debugger; Statement in Your Scripts


In debug mode, you can use the debugger; statement in your scripts.

This statement emulates the creation of a breakpoint in your script. You don't have to explicitly set a breakpoint in a script that
needs to be debugged, but the script will automatically halt its execution as soon as the debugger; statement in your script is
interpreted.

This lets you check at design time the points at which your script needs to be paused during runtime.

 Example
You add the debugger; statement to your script at design time.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 29/66
8/9/2020
When you run your analytic application in debug mode, the script will automatically stop its execution at the debugger;
statement.

Viewing Your Comments in Your Scripts


In debug mode, your script comments are generated into the transformed JavaScript. This helps you recognize your scripts in the
Web browser's development tools.

Checking the Reference List


A reference list can help you quickly check out where and how an element, such as a widget, script variable or a pop-up function is
used.

Context
After opening the reference list of an element, the information panel will display all the related elements referencing it. This is
especially helpful when you want to better understand the business logic of an application or want to change or delete a speci c
element in a complex analytic application.

Procedure
1. Hover the mouse over the name of the element (for example: Button_1) that you want to check its usage.

An button is displayed right next to the element's name.

2. Click on the button and choose Find Reference.

The information panel is opened at the button of the page showing the reference list of the element.

3. In the Reference List page, click any of the referencing element to highlight that element in the Main Canvas; and click any
script to directly go to the speci c script.

4. To expand or collapse all the components in the Reference List, click the button to the upper right corner of the Info
Panel.

5. After nishing checking the reference list, click the button (Info Panel) to hide or reopen the reference list.

Checking the Error Panel


The error panel provides you a central place to view all the errors and warnings in the application and allows you to quickly locate
the errors in your scripts.

Procedure
1. Click the button (Info Panel).

The Error panel is displayed.

 Note
The count number displayed by the (Info Panel) icon only indicates number of errors, but not includes warnings. The
number counts all errors in the application including those in the canvas and popups, even if you set lters for them in
the error panel later.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 30/66
8/9/2020
2. Click any error or warning item from the error panel and the corresponding script containing that error will open with the
error highlighted.

Once an error or warning is xed, it will no longer display in the error panel.

 Note
To lter errors, for example, by the name of the corresponding widget, you can enter the key in the lter box.

To choose to display only errors or warnings, click the button to the upper right corner of the Info Panel and choose
corresponding options.

To expand or collapse all the components in the Error list, click the button to the upper right corner of the Info Panel
and choose corresponding options.

3. After xing all the errors, click the button (Info Panel) in the toolbar or choose in the Info Panel to hide the error
panel.

View Recent Analytic Applications on Home


Screen
When you start SAP Analytics Cloud, the Home screen displays tile-like widgets to help you get started working on your analytic
tasks.

Besides the recent story tile, as an application designer or application user you can view recent analytic applications in another tile
on the Home screen.

 Note
The Recent Analytic Applications tile is displayed by default on the Home screen of all customers using analytics designer
after the feature is generally available. For ramp-up customers, it's not displayed by default. In that case you need to follow the
steps in Customize Home Screen Tiles to enable the tile.

Set the Default Home Screen Tiles


As a system administrator, you can set the tiles that appear on the Home screen for all users using the system's default options.

1. Go to System Administration Appearance

2. In the section Home Screen Tiles, enable the option Recent Analytic Applications.

Customize Home Screen Tiles


Later each user can customize their own Home screen tiles in addition to the system’s default options. The customized changes
will override any default settings applied by the system administrator.

1. Go to Home Edit Home Screen

2. In the section Home Screen Tiles, enable the option Recent Analytic Applications.

The 5 analytic applications you viewed or edited most recently are displayed in the tile.

3. To open the analytic application in View mode, click the application in the tile.

4. As an application designer, to open the analytic application in Edit mode for further editing, choose the button beside
the application and select Open in edit mode.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 31/66
8/9/2020

Browsing Applications
To access the le repository, select Browse Files in the main menu . Here you can nd:

lters

all existing public analytic applications

your private applications

applications shared with you

Applications saved in a public folder have read-only status for other users by default. You need to explicitly share your application
with other users and give them a create, read, update and delete access to allow them to edit the applications.

Related Information
Granting Permissions for Analytic Applications

Managing Analytic Applications


You can open, create, edit, and share analytic applications in the Analytic Applications area. When you open an analytic
application it opens in Design Mode by default. You can execute the application by selecting theRun Analytic Application button.

Create a New Analytic Application


You can create a new analytic application from the applications page. For more information, see Creating a New Analytic
Application.

Change the Name or Description of an Analytic Application


Select the check box for the analytic application and select (Edit).

With an analytic application open, choose (Edit Analytic Application) Analytic Application Details .

Copy an Analytic Application


You can copy an entire analytic application to a new application as follows:

1. On the Files page, select the check box for the analytic application you want to copy and select (Copy to).

2. (Optional) Specify the analytic application's path – you can select public or samples.

 Note
A public analytic application is visible to all users.

3. Enter a unique name for the analytic application.

 Note
Valid characters are alphanumeric characters and underscores. Spaces can be included but not at the start or end of a
name.

4. Enter an optional description.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 32/66
8/9/2020

Translate Analytic Applications


You can translate user-de ned strings of widgets, popups and application description for your analytic applications.

Define Theme for Analytic Applications


You can de ne the style of an analytic application by creating a theme or using an existing theme.

Share Applications
You can share analytic applications and change sharing settings.

Related Information
Translating Analytic Applications
De ning Themes for Analytic Applications
Sharing Analytic Applications
Modifying Sharing Settings

Translating Analytic Applications


The translation feature enables you to translate and switch the languages of user-de ned strings in an analytic application.

Context
Translation is used in both stories and analytic applications. Only the strings speci c for the analytics designer are listed here.

Text in a button, dropdown, checkbox group or radio button group

Tooltip in a button or dropdown

Label Text in a checkbox group or radio button group

Display Hint of an input eld

Dialog Title and Button Text of a popup

Description of an analytic application

 Note
As the values of widgets such as values in a dropdown box can be used as reference keys in scripts, they are not available for
translation.

Procedure
1. Enable an analytic application for translation.

a. From the Main Menu, select Browse Files .

b. Open the analytic application you want to translate.

c. Click the (Edit Analytic Application) button and choose Analytic Application Details.

d. Turn on Mark for translation.

e. Click OK.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 33/66
8/9/2020

 Note
The Data Access Language you set up in the Profile Settings the moment you enable translation for an application
becomes the source language of new widgets. After you nish translating the text and switch the software to other
language via the Data Access Language, the application can only be opened in the view mode.

 Note
If you disable Mark for translation for an analytic application that has been enabled for translation, all the relevant
translations will be removed accordingly from the translation dashboard.

2. Check the content to be translated.

After enabling translation for an analytic application, the application will be listed in the translation dashboard. For more
detailed information, see Translator Role and Translation Dashboard.

3. Translate the strings in either of the two ways:

Translate in batch with the help of XLIFF les. You can start translating this application by exporting strings as XLIFF
le and then importing the translated XLIFF le. For more information, refer to Importing XLIFF Files and Exporting
XLIFF Files.

Ad-hoc inline translation in the translation dashboard. You can also directly translate strings in the translation
dashboard. For more information, see Editing Translated Text.

4. Manage or delete your translations.

After you complete the translation, you can further manage the translated content or delete a particular language
translation. For more information, refer to Managing Translations and Deleting Translations.

 Note
If you delete an analytic application, the relevant translations will still exist in the translation dashboard until the
analytic application is permanently deleted from Deleted Files.

Bookmarking Analytic Applications


Bookmark lets you, as an application user, capture and save the current state of an analytic application.

When viewing an analytic application, you may want to come back to the same view of the data or directly enter different states of
data without having to spend time resetting all the widget states in the analytic application. In this case, you can save a speci c
view of data or different states of data as bookmarks.

In an analytic application, you can bookmark the changes of a widget itself and the display of the data in it, including but not
limited to the following:

width and height of all widgets

whether a widget or components in a widget is visible or not

dimensions and measures added to or removed from a chart or table

hierarchy level of the data in a chart or table

sorting, ranking, ltering, drilling of data in a chart or table

show/hide of a grid, header, title, subtitle, unbooked members, total values in a table

items added to or removed from a dropdown, radio button group or checkbox group

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 34/66
8/9/2020
selected key in a dropdown, radio button group or checkbox group

hyperlinks set for an image or shape

text applied to a text widget or text changes in an input eld

max value, min value and current value of a slider and range slider

 Note
You cannot bookmark translated contents, expect for the bookmark name.

 Note
You cannot bookmark changes you make to the non-primitive type script variables (types other than string, boolean, integer
and number).

 Note
For any new bookmark versions created after wave 2019.19, the settings of Unrestricted Drilling you've de ned when setting
date range for time dimension will take effect. However, this won't apply to the old bookmark versions created before this wave.

Tasks
Bookmarks Roles and Permissions

Bookmarking Current State

Managing Bookmarks

Bookmarking Current State


As an application designer, you need to create a Bookmark Set scripting object before application users can save the current state
of an analytic application as a bookmark.

Procedure
1. In the Scripting section of the Outline, select right next to Bookmark Set.

The side panel Bookmark Set opens with the default name of the bookmark BookmarkSet_1. You can change the name if
you want to.

2. In the side panel, enter a Version number. The number must be an integer.

 Note
To generate a new version of the bookmark set at any time, you change the version number.

After that, all the bookmarks you created based on the previous version will become invalid. To reopen the invalid
bookmarks, you need to change the version number back to the previous one.

3. In the side panel, select Included Components to choose the canvas, popups, widgets, and scripting objects to be included
in the bookmark set.

4. Click Done to nish creating the bookmark set scripting object.

5. To allow application users to save a bookmark when viewing the analytic application, you need to add a widget such as a
button and write script for the widget, using the syntax below:

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 35/66
8/9/2020

 Code Syntax
// Save a bookmark of the current state of application with "Personal" or "Global" visibility
save (bookmarkName: string, isGlobal: boolean, override?: boolean): BookmarkInfo

6. Save and run the analytic application.

Application users can now change the states of widgets in the analytic application at will and trigger the widget to save
different states as bookmarks.

Results
After saving the bookmark, both you and application users with proper authorizations can check it in the (Main Menu)
Browse Analytic Application Bookmarks menu. To view all bookmarks of a speci c application, go to the analytic application,
select (More actions) to the right of the application and choose Browse Bookmarks.

 Note
A bookmark is valid only when its version is consistent with the current version of the bookmark set scripting object. If not, the
bookmark is invalid and cannot be opened.

To use a valid bookmark, click the bookmark and open it in the view mode.

Related Information
Managing Bookmarks

Managing Bookmarks
Application users can manage bookmarks either in the Files repository, or directly in the analytic application with the help of their
application designer.

Managing Bookmarks
To manage your bookmarks go to (Main Menu) Browse Analytic Application Bookmarks . You rst select a bookmark,
then follow these steps to edit, share, and delete a bookmark as needed:

Select (Edit) to change the name and type (Personal or Global) of the bookmark.

Select (Share) to share the personal bookmark with other application users or teams.

Select (Delete) to delete a bookmark you no longer need.

 Note
When you share an analytic application with other users, only global bookmarks will be shared. Personal bookmarks won't be
included.

To search for a speci c bookmark, enter the bookmark name in the search box. To narrow down the lter scope, choose Valid
Bookmarks, Invalid Bookmarks, or All Bookmarks from the dropdown list to the left of the search box.

Managing Bookmarks in the Analytic Application

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 36/66
8/9/2020
As an application designer you can also leverage the following APIs to allow application users to directly save, list, or delete
bookmarks in an analytic application:

 Code Syntax
save(bookmarkName: string, isGlobal: boolean, override?: boolean): BookmarkInfo // Save bookmark b
getAll(): BookmarkInfo[] // Returns all valid bookmarks of current application.
getAppliedBookmark(): BookmarkInfo // Returns the bookmark which is applied to current application
getVersion(): integer // Returns current bookmark version of application.
deleteBookmark(bookmark: string|BookmarkInfo): boolean // Deletes specified bookmark of applicatio

Here are some script examples that show how to enable application users to save, list, and delete bookmarks in view mode.

 Example
In this example, you want to design an application that allows application users to capture the states of their application and
save them as bookmarks.

First, in addition to the scripting object BookmarkSet_1, add an input eld (InputField_1) and a button (Button_1) to the
Canvas.

Then write the following script for Button_1:

 Sample Code
var name = InputField_1.getValue();
BookmarkSet_1.save(name, true, true); // Create a bookmark with the name input in the input field.

 Example
Furthermore in this example, you want to allow application users to list all the available bookmarks and remove any bookmark.

First, in addition to the scripting object BookmarkSet_1, add a dropdown (Dropdown_1) and another button (Button_2) to the
Canvas.

Then write the following scripts for the widgets:

For Dropdown_1:

 Sample Code
var bookmarks = BookmarkSet_1.getAll();
Dropdown_1.removeAllItems();
for (var i=0; i < bookmarks.length;++i)
{
Dropdown_1.addItem(bookmarks[i].id, bookmarks[i].name);
}
if (bookmarks.length > 0)
{
Dropdown_1.getSelectedKey();
}

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 37/66
8/9/2020
For Button_2:

 Sample Code
BookmarkSet_1.deleteBookmark(Dropdown_1.getSelectedKey());

When application users select the dropdown box, all the available bookmarks will be listed. And if they click the
Remove Bookmark button, the bookmark chosen in the dropdown will be deleted.

Related Information
Bookmarking Current State

De ning Themes for Analytic Applications


Themes provide application designers with an efficient and reusable way to de ne the style of the application.

A theme is a one-stop solution to your enterprise's branding. It provides you with a consistent look and feel that complies to the
corporate standard, while differentiating itself from hundreds of other apps. As an application designer, you can de ne a theme to
store your favorite styles of canvas, pages, popups, and different types of widgets, or choose an existing theme to change the
application's look and feel instantly.

After you create a theme, it's saved to the Files repository. You can reuse it in any other analytic applications according to your
needs.

In the following topics, you will learn how to create, use, modify, and delete a theme, and how to override the theme settings of a
speci c widget.

Tasks
Creating a Theme

Using, Modifying, and Deleting a Theme

Using the Theme API

Creating a Theme
As an application designer, you can follow the steps below to create a new theme.

Prerequisites
To create a theme, you must have the appropriate permissions for this analytic application item. For example, the Application
Creator and Admin roles contain these permissions.

Procedure
1. Select (Theme) in the Display section and select Create Theme….

2. In the Theme Preferences dialog, change the background color of canvas or popups and different style settings of widgets
as you wish.

3. Select Save as to save your theme to the Files repository.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 38/66
8/9/2020
4. In the Save As New Theme dialog, choose a folder to store the theme and enter a name and optionally a description.

5. Click OK.

Results
The new theme is created and applied to the analytic application. You can also reuse it in any other analytic applications.

Using, Modifying, and Deleting a Theme


You can directly use an existing theme to de ne your analytic applications or modify and override the existing theme preferences
according to your needs.

Prerequisites
To create and use a theme, you must have the appropriate permissions for the analytic application item. For example, the
Application Creator or Admin roles contain these permissions.

If the theme is created by another user, make sure you have access to the theme in the Files repository.

Procedure
1. Select (Theme) in the Display section and choose a theme:

You can directly select a theme displayed in the dropdown list.

Or you can click Browse for More Themes… to choose another theme from Files repository.

Once you have selected a theme, it applies to the analytic application instantly.

2. If you want to delete the theme, go to the Files repository to select the theme and click the (Delete) button.

3. (Optional) To override the theme preferences, you can select a widget, canvas, or popup and change its styles in the Styling
panel.

 Note
Even if you change to another theme, the widget style you de ned in the Styling panel will be kept. But you can select
(Restore to Theme Preferences) on the upper-right corner of the Styling panel to restore to the current theme's
default setting.

4. To modify the theme preferences:

a. Select (Preferences) to the right of the theme in the Theme dropdown list.

b. Change the theme settings according to your needs.

c. Save the changes:

If you want to save these changes in the current theme, select Save Save and Apply .

 Note
Theme updates will not only apply to your current theme, but also apply to all analytic applications using
the theme.

If you want to save these changes to a new theme, select Save as.

Results
If you open an analytic application whose theme is changed:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 39/66
8/9/2020
In edit mode, you can decide whether to apply the updated theme or keep the current theme settings by saving as a new
theme.

In view mode, the analytic application will display the latest theme settings.

If you open an analytic application whose theme is deleted,

In edit mode, you can decide whether to apply the default theme or keep the current theme settings by saving as a new
theme.

In view mode, the analytic application will display the Light Theme (Default) setting.

Using the Theme API


As an application designer, you can leverage the setTheme() API to allow end users to exibly change the theme of their
application when running an application.

To specify a theme, use the syntax Application.setTheme(), type Ctrl + Space and the theme selector will
automatically pop up for you to choose the theme you want to apply from the Files repository. After you choose a theme, the
corresponding theme ID will be displayed in the syntax. If you choose not to de ne a theme in the syntax, then the application will
apply the default light theme instead.

 Note
Currently, there's a limitation that calling the setTheme() API in a popup does not affect the theme settings in the popup. To
solve this, you can add a panel to a popup and include all widgets in it. Then, when you trigger the setTheme() API in a
popup, all widgets added to the panel will apply the new settings.

Here's an example that shows how to leverage the theme API to allow end users to switch between different themes for your
application.

 Example
First add a drop-down widget Theme_Dropdown to the canvas. In the builder panel of the drop-down, ll the value column
with the theme IDs and the text column with corresponding theme names.

Then write the following script for the drop-down:

 Sample Code
var themeId = Theme_Dropdown.getSelectedKey();
Application.setTheme(themeId);

Now, when users run the application, they can select a theme from the drop-down list to change to a different theme.

As well as using the theme API, you can also enable end users to apply a speci c theme when loading an analytic application by
directly adding the theme ID to the application's URL address. For example, like this:

https://master-app-building /sap/fpa/ui/bo/application/4FA12EC04829FDC682399273A7A3A0C?
mode=embed;themeId=D991AAEEC518947626D749EDFF57D64C

De ning Busy Indicator


https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 40/66
8/9/2020
As an application designer, you can de ne a busy indicator for long running actions, for example when refreshing an application or
running a long script, to temporarily block application users from doing other actions while the action is running.

There are two types of busy indicator:

Busy indicator that displays automatically when loading is longer than the prede ned delay. Once it’s triggered, the entire
application is blocked.

Busy indicator that’s owned by an application, a pop up or a container such as a tab strip or panel. It’s de ned using APIs
and when it’s triggered, only the speci c container you de ne busy indicator for is blocked.

Automatic Busy indicator


The automatic busy indicator can be triggered either by application-level or widget-level loading activities. Whenever there’s a
loading that exceeds the prede ned delay time, the entire application is blocked.

The busy indicator is by default not enabled, to enable an automatic busy indicator, do as follows:

1. Go to the Styling panel of the Canvas.

2. In Loading Indicator Settings of the Application Settings, check the option Enable loading indicator when necessary.

3. (optional) Enter an information text that you want to display along with the loading indicator icon.

4. In Loading Indicator Delay, de ne when a loading activity is executed longer than how many milliseconds, the loading
indicator will show up.

Besides enabling an automatic busy indicator in the Styling panel, you can also choose to enable or disable such busy indicator
whenever needed using the API:

 Code Syntax
Application.setAutomaticBusyIndicatorEnabled (enabled: boolean)

If you set a busy indicator to enabled via the API, its information text and loading indicator delay time will follow the corresponding
settings de ned in the Loading Indicator Settings of the Styling panel.

After a loading activity is completed, the loading indicator will automatically disappear.

Busy indicator Owned by each Widget defined Using APIs


You can leverage the show/hide busy indicator APIs to show or hide a busy indicator for:

an application

a pop up

a container (including tab strip and panel)

Corresponding APIs are as below:

 Code Syntax
// Show busy indicator. And if the text parameter is specified, show the text along with the busy i
Application.showBusyIndicator(text?: string) // cover the whole page
Popup_1.showBusyIndicator(text?: string) // cover the pop up only
TabStrip_1.showBusyIndicator(text?: string) // cover the tab strip only

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 41/66
8/9/2020
Panel_1.showBusyIndicator(text?: string) // cover the panel only

// Hide busy indicator


Application.hideBusyIndicator()
Popup_1.hideBusyIndicator()
TabStrip_1.hideBusyIndicator()
Panel_1.hideBusyIndicator()

The automatic busy indicator is fully independent of the busy indicators owned by each widget, which means that when automatic
busy indicator is enabled, it won’t affect calls to Application.showBusyIndicator() or
Application.hideBusyIndicator().

Example: Configure the show or hide of busy indicator when using PostMeassage API to send requests

 Sample Code
In this example, you can write scripts to show the indicator when using PostMessage to send a request and hide the indicator
when getting the response from outside page.

button.onClick() {
Application.showBusyIndicator(); // Show application manual indicator
Application.postMessage(PostMessageReceiver.Parent, message, "http://localhost:8080");
}

Application.onPostMessageReceived(message:string, origin: string) {


if (message === "JOB_DONE") {
Application.hideBusyIndicator();// Hide application manual indicator when getting the respo
}
}

Exporting an Analytic Application as a


PDF
As an analytic application designer, you can allow users to export an application as a PDF le when running the application.

Context
Only visible content on your application page can be exported to the PDF le. Therefore, the following invisible elements will not be
exported:

invisible part in scrollable charts, tables or tab strips

collapsed table cells

lazy rendered widgets

lazy loaded data source

comments on invisible data cells

Besides these invisible elements, custom widgets and web page widgets won’t be exported.

For a popup, only a popup that’s visible in an analytic application, namely a popup a user has triggered to pop up when running an
application will be exported as a separate page in the PDF le.

 Note

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 42/66
8/9/2020
Same as that in a story, for a R visualization widget, static plots will be exported. But if the R widget is written in RHTML
(iFrame) instead, it won’t be exported.

Procedure
1. In the Scripting section of the Outline, select right next to Export to PDF to create a technical object.

2. The side panel Export to PDF opens with a default name ExportToPDF_1 displayed. You can set the following properties
according to your needs:

Change the default name of the technical object.

Select the paper size of the exported PDF as Auto, A2, A3, A4, A5, Letter or Legal.

Select the orientation of the exported PDF as Landscape or Portrait. The Orientation option is disabled when the
paper size is set to Auto.

Select the location of the page number as Header, Footer or None.

Edit the le name, the header, the footer for the exported PDF.

Choose whether or not to export the appendix. The appendix will be exported as separate page.

Choose whether or not to export the comments. Comments of invisible widget will not be exported. The comments
will be exported as separate pages.

 Note
If you haven't enable the option Commenting in Embedded Mode via System Administration System
Configuration , the commenting related settings and APIs won’t take effect.

3. Click Done to nish creating the technical object.

4. To invoke the Export to PDF function, write the script ExportToPDF_1.exportView() for the triggering event of the
canvas or a widget. For example, if you want to invoke the function when clicking a button, write the script for the
onClick() event of the button.

 Note
Similar to exporting to PDF in a story, the API that triggers the export is supported only in Microsoft Edge and Google
Chrome, but not in Internet Explorer.

5. As an application designer, the properties you de ned in the Export to PDF panel will be the default export settings for all
users running the application. To offer end users the exibility to customize the export settings, you can design a new
settings panel or dialog by leveraging relevant APIs. For detailed information about the APIs, refer to Analytics Designer API
Reference.

Results
An exported PDF is saved to your local machine, which shows exactly what appears on the application running page.

Schedule Publication for an Analytic


Application
You can schedule a publication for publishing and distributing analytic application views to users or user groups of your choice via
email in PDF format at a prede ned time or frequency.

Prerequisites

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 43/66
8/9/2020
To be able to schedule a publication, you must have the appropriate permission and turned on the mandatory system
con guration settings. For detailed information, refer to Schedule Publication Roles and Permissions.

Besides that, to be able to generate PDF for the publication, you must add an ExportToPDF technical object to the analytic
application.

Context
You can schedule a publication for both stories and analytic applications. Same as for a story, you can create a single schedule or a
recurring schedule. You can later view, modify, or delete an occurrence or a recurrence of the schedule in Calendar.

In this chapter, only the publication settings and con gurations speci c for the Analytics Designer are listed.

There are two ways of triggering PDF export when scheduling a publication for an analytic application:

Automatically generate PDF export. This is the default setting, PDF will be generated automatically when the render of
application is considered to completed. In this case, you don’t have to write scripts. An application will be considered fully
rendered when the last line of script in the onInitialization event is executed. Any event scripting happened after
that will be bypassed.

Manually generate PDF export via API. This is the advanced setting that we recommend if you want to control the timing of
the PDF export more accurately and not to miss any relevant event scripting happened after the onInitialization
event is completed.

In this case, we recommend you write the following script as the last line of code for the onInitialization event of
the Canvas:

If (Application.isRunBySchedulePublication()) {

Scheduling.publish();

The two schedule publication settings can be con gured in the Styling panel of the Canvas.

Procedure
1. Use either of the two ways to schedule publication for an analytic application:

On the Files page (from main menu, Browse Files ), select the analytic application that you want to schedule and
from the toolbar, select  Schedule Publication from (Share).

In the application’s run time, from the toolbar, select Schedule Publication from (Share).

The Schedule Publication dialog box appears.

2. In the Schedule Publication dialog, by default, the name of the application is automatically lled as the name of the
schedule. You can edit the name as you wish.

3. In the Start eld, click  to specify the start date and the time you want the schedule to run. Then click Add Recurrence if
you want to schedule publication based on a certain recurrence pattern.

4. In the Subject eld, enter the subject of the email.

5. (Optional) In the Message eld, type in a message for the email.

6. Select the Include Analytic Application Link option, if you want to include in the email a link to navigate email recipients to
the analytic application.

7. To enable application users to customize the values of script variables when opening the application, turn on the option
Customize Script Variable.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 44/66
8/9/2020
Then you can add one or more script variables for application users to customize, as well as de ne a default value for each
of them.

 Note
Only the variables that are exposed via URL parameters and can be con gured via URL will be included.

8. Add one or more views in the Distribution part to schedule and share customized views of your application or bookmarks of
the analytic application. You can specify same or different SAP Analytics Cloud recipients or non-SAP Analytics Cloud
recipients for each view.

 Note
For each view, you’ll have up to 60 seconds to generate PDF export. If the time exceeds that limit, scheduling will skip
current task and continue to publish the next view.

9. (Optional) Edit the name of the PDF le from the File Name eld.

10. Click PDF Settings to con gure the PDF settings such as the paper size and choose whether to include appendix or
comment or not.

11. Click OK.

The schedule is successfully created and is displayed in Calendar.

12. You can view, modify, or delete an occurrence or a recurrence of the schedule in the Calendar.

Sharing Analytic Applications


You can share analytic applications.

Procedure
1. On the Files page, select the check boxes for all analytic applications that you want to share and select
(Manage) Share .

2. Under People, add all users you want to share with.

You can either type a username or select (Add Usernames) to open a list of available users.

3. Under Access, select the permissions you want to grant the selected users. By default Read only access is selected.

 Note
Users with read-only access are able to change the variables for the model in the analytic application. Changing the
model variables updates all the charts and tables in the application unless they were overridden.

4. Select Send to share with the selected users.

Related Information
Modifying Sharing Settings

Modifying Sharing Settings


Modifying the share settings allows you to grant custom share permissions to all users, teams, or individual users.

Context

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 45/66
8/9/2020
You can only modify the sharing settings for a single analytic application at a time. To set permissions for multiple applications,
select applications, then set permissions in the Access list in the Share dialog for analytic applications.

Procedure
1. On the Files page, select a check box beside an application.

2. Select (Manage) Sharing Settings .

3. Select permissions for User/Team or All Users.

4. (Optional) Select Add Users and Teams, and choose individual teams or users from the list, then assign permissions to
teams or users.

5. Select Save.

Results
When you share the selected analytic application, the settings you saved will be applied.

 Note
The settings are only saved for an individual analytic application. If you select a different application, you will need to save new
share settings.

Message Communication Between Host and


Embedded Web Pages
When you embed analytic application in a host HTML page or embed a web page in analytic application through the web page
widget, you can follow this guide to enable message communication between host and embedded web pages.

Using the posting message API, you as the application developer can realize either of the following scenarios:

Scenario 1: Embedding analytic application in a host HTML page via iFrame


Before embedding an analytic application via a iFrame in the host HTML page, you need to rst make sure the host HTML page is
added as a trust origin in the System Administration App Integration Trusted Origin .

Then you can trigger bi-direction communication between the host HTML page and analytic application using the provided
functions.

postMessage

This is to post messages from the analytic application to the host HTML page.

When an end user triggers a callback function in the analytic application side, the callback function sends out data to notify the
parent receiver page which hosts the iFrame, or, when there are multiple levels of web pages embedded in one another, to the top-
level HTML page of a speci c target origin.

You de ne whether to send data to a parent or the top HTML page by means of the parameter of the PostMessageReceiver.

The syntax of the postMessage event is:

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 46/66
8/9/2020
postMessage (receiver: PostMessageReceiver, message: string, targetOrigin: string): void

onPostMessageReceived

This is to handle messages sent from the host parent or top HTML page in the analytic application. In scenario 2 below, the event
can also handle messages sent from an HTML page embedded via the web page widget in an analytic application.

 Caution
We advise you always check the origin when receiving an event-triggered message, because a malicious site can change the
location of the window and therefore intercept the data you sent using the postMessage event without your knowledge.

In the current scenario, the parent window which hosts the iFrame can post messages to the analytic application's iFrame window
of speci c target origin. The messages posted are then retrieved by the analytic application and trigger changes accordingly, such
as updating some input data.

The syntax of the onPostMessageReceived event is:

onPostMessageReceived(message: string, origin: string)

A Code Example

You embed an analytic application in a host HTML page. The URL of the host HTML page is http://localhost:8080.

First, you want to allow end users to post the company selection in the analytic application to the host HTML page. Write the script
below for the sending button:

 Sample Code
var message = RadioButtonGroup_Company.getSelectedText();
Application.postMessage(PostMessageReceiver.Parent, message, "http://localhost:8080");

Then you want to allow end users to display the message received from the Host HTML page in a text box of the embedded
analytic application. Click the button beside Main Canvas, choose onPostMessageReceived and write the script below for the
application:

 Sample Code
If (origin == “http://localhost:8080”) {
Text_ReceivedMessage.applyText(message);}

Scenario 2: Embedding web application in an analytic application through the web


page widget
You can trigger bi-direction communication between the embedded web application and the host analytic application.

Web Page Widget Related postMessage and OnPostMessageReceived

When the host analytic application's web page widget embeds a web application, you can post messages from the embedded
application to the host analytic application or the other way around.

The syntax of the postMessage event is:

postMessage(message: string, targetOrigin: string): void

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 47/66
8/9/2020

 Note
The target origin is optional. If left empty, the URL de ned in the web page widget will be taken as the target origin by default.

The syntax of the onPostMessageReceived event is:

onPostMessageReceived(message: string, origin: string)

Case 1. Posting messages from the host analytic application to the embedded application

The event for posting messages is:

postMessage()

The event for handling messages sent from the host analytic application depends on the type of the embedded application:

If the embedded application is an SAP Analytics Cloud application, once the message is received, the embedded
application can use the event onPostMessageReceived() to handle the message.

If the embedded application is another web application, once the message is received, the embedded application can use
the event window.on("message") to handle the message.

Case 2. Posting messages from the embedded application to the host analytic application

The event for posting messages depends on the type of the embedded application:

If the embedded application is an SAP Analytics Cloud application, use the event Application.postMessage() to
post messages.

If the embedded application is another web application, use the event window.parent.postMessage to post
messages.

The event for handling messages sent from embedded application is:

Once the messages is received, the host application can use the event onPostMessageReceived() to handle the messages.

Transporting Analytic Applications


You can export your analytic applications to other SAP Analytics Cloud tenants, or import analytic applications from other SAP
Analytics Cloud tenants to your tenant.

Context
You can transport your analytic applications with data, or choose other options. For more information, see Importing and
Exporting Content.

 Note
The SAP Analytics Cloud software release versions installed on the source and target tenants need to match (same version) or
may differ in only one version.

Styling Options for Widgets and Canvas


You can style the appearance of a widget by changing fonts, colors, axis scaling on charts, and so on, or change its size and set its
position in the widget's parent container. You can also style the size of the canvas by de ning it as xed or dynamic.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 48/66
8/9/2020
The styling option is available in both stories and analytic applications. Only the styling options speci c to the analytics designer
are listed.

Define the Size and Position of a Widget


As an application designer, you can de ne the size of the widget and set its position in its parent container in the Size and Position
section of the Styling panel. The parent container can be a popup, a canvas, a panel or a tab strip.

In the Size and Position, Left de nes the widget's distance to the left border of its parent container. The value of left margin can be
de ned as auto, pixel or percent. When a widget is smaller than its parent container, the sum value of its left margin, right margin
and the widget's width should be no bigger than the width of the parent container. But when the parent container is a panel or tab
strip, a widget's width alone can be bigger than the width of the parent container. This equally applies to the Top and bottom
margin and the widget's height.

Define the Dynamic Layout for the Canvas


As an application designer, you can de ne the dynamic layout for the canvas in the Dynamic option under the Canvas Size section
of the Styling panel.

When you select the Dynamic option, the Canvas Content Layout option displays, from which:

If you select the option Center Aligned, all contents in the canvas will always be center aligned horizontally after running
the application.

If you select the option Fit to Device, the canvas size will be automatically adjusted to the certain device size. If the size or
position of canvas’ contents position are de ned as auto or percent, their size or position will automatically t to the device
size. You can also enable the Live device preview bar to preview the contents on different devices as shown below.

 Note
Before wave 2019.20, the canvas content layout of an analytic application is by default center aligned, now it's t to
device.

Configure Whether the Quick Menu Is Visible or Not During Application Runtime
In the Styling panel of a widget, the section Quick Menus controls whether the quick menu bar itself and the options in it are
visible or not when running the analytic application. Quick menu here refers to both the quick menu of a widget and data points in
a table or chart widget (see the example below).

To disable an option in a quick menu – for example, if you don’t want end users to export a chart for security reasons – you can go
to the Styling panel of the chart and uncheck the option Export as CSV in Quick Menus. Then the option won't be available when
running the analytic application.

Working Simultaneously on One Application


with Several Users
Because several users can work on one application at the same time, there could be con icts when the application is saved.
Therefore, system noti cations inform you how to proceed.

Edit notification
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 49/66
8/9/2020
If you edit an application simultaneously with one or more different users at design time, you will get a system noti cation telling
you that there are other users editing the analytic application. This noti cation will also provide a link to save the application.

Save notification
If another user has already saved the application you are editing, you will get a system noti cation that the application has been
updated by another user. Additionally, you can save a copy of the application or open the last revision.

 Note
At this time, you cannot use the keyboard shortcuts for saving the application because they are disabled.

To save the application under a new name, click Save a Copy. This will open the dialog for saving the application under a
name that you choose.

To open the newest version of the application, click Open Latest Revision. This will load the application that the other user
has saved.

 Note
If you have made changes to the application and click Open Latest Revision, your changes will be lost.

If you ignore this noti cation, or close it, you are able to continue the work on your application. You may, however, only save a copy
of the application.

Disabled save menu entry


If you open the latest revision of the application, the newer version of the application will be displayed. You can continue to edit the
application. The edit system noti cation is displayed as long as other users are editing the same application as you. You can either
save the application under a new name or open another one.

The Save entry is disabled.

 Note
The edit and save noti cations are displayed only if you use the supported Web browsers. As of today, these are Google
Chrome and Microsoft Edge.

Merging SAP BW Queries in Charts


You can improve the performance of your analytic applications in terms of saving time, round-trips, and memory by merging
backend calls for multiple charts within an application.

To activate the query merge for SAP BW queries in your application, click (Edit Analytic Application) Query Settings . Select
Enable Query Merge.

 Note
To activate the merge for SAP HANA calculation views in your application, click (Edit Analytic Application) Query Settings
and select Enable Query Batching. Here you can also determine the number of queries to be merged (at least 4 and at most
20).

Prerequisites for Merging Queries


https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 50/66
8/9/2020
In general, charts within an application need to have the same query and the same variables as a basis in order to merge the
queries.

You can merge queries if the following factors apply:

Queries contain the same dimensions with the same hierarchies and drill.

Queries use the same sorting and ranking.

The application does not have lters de ned inside the threshold panel.

The widget does not have a local lter on a dimension that is also used in a restriction in SAP BW.

Queries are part of the same receiver group if they use linked analysis.

The widget does not have a local lter on a member of the secondary structure of a query..

The widget lter is not de ned as complex tuple or range lter.

Presentation types are the same.

Chart Types Supporting Query Merging


Instead of sending single queries for each chart widget, you can combine requests with each other. The following chart types
support the query merge:

Bar/Column

Combination Column & Line

Combination Stacked Column & Line

Stacked Bar/Column

Stacked Area

Line

Bullet

Numeric Point

Working with Lazy Loading in Analytics


Designer (Beta)
You can use lazy loading to improve the performance of your analytic application at startup.

Context

 Note
Lazy loading in analytics designer is currently only available for selected Beta customers. If you are interested in the Beta
program, please contact your SAP account manager.

Please note that the following conditions apply during the Beta period:

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 51/66
8/9/2020
Your company acknowledges that the software is a preliminary version and not subject to any productive use license
agreement or any other agreement with SAP.

SAP has no obligation to include or remove any functionality from the software in any future version or in any SAP
standard product.

To run lazy loading for your application, you can do the following:

Procedure
1. For data-bound widgets in your application (tables or charts), check the widget property Disable Initial Load in the Builder
panel.

2. Call the script function getDataSource().load() of data-bound widgets at the point in time when the widgets should
be loaded. Usually this script is part of an event handler script triggered by a user interaction; for example, the onClick
handler of a button widget.

 Example
Chart_1.getDataSource().load();

Viewing Analytic Application Embedded in


Your Own Application in Safari on iPad
After embedding an analytic application in your own application, for example in your company's portal via iFrame, you can now
directly view the embedded analytic application in Safari on iPad with an optimized user experience.

Please note that directly opening the analytic application from the Files Repository is not supported.

Prerequisite
First mark an application as mobile enabled. To do this, from the File in the toolbar, choose (Edit Analytic Application) Analytic
Application Details , and turn on the option Access the app from mobile device.

Before viewing an analytic application in Safari, go to Safari browser’s setting Preference Privacy and uncheck two options:
Prevent cross-site tracking and Block all cookies.

Also make sure you've met the minimum requirements for iOS and iPad. For details, refer to the Mobile Requirements section in
System Requirements and Technical Prerequisites.

Restrictions
When working with an analytic application on a mobile device, the widgets below are not supported:

Geo map

R visualization

Custom widget

When working with an analytic application on mobile devices, the SAP Analytics Cloud features below are not supported:

Exporting the application as a PDF

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 52/66
8/9/2020
Creating a story from a widget

Smart discovery

Smart insight

Data explorer

API support
There's an API that indicates whether the app is in mobile mode or not:

Application.isMobile(): Boolean

It returns true when the app is displayed in Safari on an iPad.

Using Popups
You can use popups to design interactive analytic applications and dashboards.

Context
The popup helps application users to quickly enter information, perform con gurations, or make selections. You can also use
them to display more speci c data for a selected item displayed on the main page of the application. Because the popup acts as a
container widget, you can put any other widget into the popup, such as a table, button, or checkbox.

As an application designer, you can choose to design a popup starting from scratch, or enable the header and footer setting to
turn the popup directly into a popup dialog that has a consistent look and feel compared to other dialogs in SAP Analytics Cloud
stories.

Procedure
1. In the Outline panel, expand Layout and click the button right next to Popups to create a new popup.

Its icon and a default name are displayed under the Popups.

2. Double-click the new popup and rename it.

3. If you want to turn the popup into a dialog, go to the Designer panel and choose the Builder tab. In the Popup Settings, turn
on the Enable header & footer option. Otherwise, skip to step 5.

4. Optional: If you want to change the dialog title, add or remove buttons, change the IDs and descriptions of the buttons, or
customize the button details such as visible or not, enabled or not, and highlighted or not, do so in the Builder panel, then
click Apply to apply all the settings.

5. Design the popup by adding widgets to the popup, such as dropdown boxes, tables, or charts. These widgets are the
visualization of the popup. If no widgets are added, even if you save the empty popup to the analytic application you won't
see the popup displayed when you trigger it while running the analytic application.

For pop-up dialogs, you can only add widgets to areas other than the header and footer.

6. Edit the style of the popup in the Styling panel; for instance, to change the popup's height and width.

 Note
The height and width you set won't take effect if you add only one widget to the popup. To run the popup as designed,
make sure you add more than one widget to the popup.

7. Add a script to the popup by clicking the widget corresponding to the popup in the Outline panel and selecting the
button.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 53/66
8/9/2020
The script editor opens in a new tab where you can add scripts.

 Note
In the script editor you can use the value help for data-related values when writing scripts. Consider the following points
when using this value help:

The value help is always available for data-related widgets, such as tables and charts, in the main canvas.

For widgets in popups, the value help is only available after the popup has been opened at least once:

If you add a widget in a popup initially, the value help is available.

If you save an analytic application with tables or charts in a popup and reopen it, the value help is not
available in the popup for these widgets unless you open the popup at least once in design time.

8. To return to the popup itself or to the main canvas, click the button and choose your popup or the main canvas.

9. To delete the popup, choose the button next to your popup in the Outline panel and choose (Delete).

Related Information
Known Limitations to Analytics Designer

Creating and Using the Input Field


With input elds, analytic application users can enter a random value and trigger what-if scenarios based on the value entered.

Context
As an application designer, you can follow the steps below to add and con gure an input eld.

Procedure
1. On a canvas or popup page, select Input Field .

2. In the Styling panel, enter a name for the input eld widget. By default, the name is InputField_1.

3. Con gure the Display Hint option.

If you disable this option, no hint will be displayed either in the analytic application design time or at runtime. After
enabling this option and entering a hint, when application users later start to enter a value in the text box during the
analytic application runtime, the hint will be overwritten by the user-entered text automatically.

4. In InputField Style, con gure the style of the input eld such as border, background, and font size.

5. After you create and con gure the input eld widget, you can leverage existing APIs to receive user input for further
processing:

To get and set the value, use the APIs getValue() and setValue().

To tell whether an input eld is enabled or not and set an input eld to enabled, use the API isEnabled() and
setEnabled() respectively.

To tell whether an input eld is editable or not and set an input eld to editable, use the API isEditable() and
setEditable() respectively.

 Note
The difference between a disabled status and not editable status is that when you set the API setEnabled()
to false, the input eld will be grayed out during analytic application runtime, while the status not editable is not.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 54/66
8/9/2020

To trigger certain actions when the focus is no longer in the input text box during analytic application runtime, for
example, when users type Enter in the keyboard after entering a text, use the API onChange().

Working with Planning Applications


You can create applications for planning business data.

These planning applications support both manual and automated data entry and changes to data. You can enter the planning data
manually in the table (in cells or rows) or use data actions to enter data automatically.

What You Should Know


For planning data, you have to use a planning model for the table in the application. If you use a planning model for the table, the
table property Planning enabled is active in the Builder panel. This property controls whether the table is input-enabled or not.
Unlike the story, the table is only input-enabled during runtime.

 Note
At design time you cannot enter values in the table.

Entering Data
You can enter data by clicking in the cell and entering values. After you have entered data, the changed cells are highlighted in the
table. For more information, see Entering Values in a Table.

Using the Table's Quick Actions Menu for Planning


The table's quick action menu lets you use planning-related functions. They are only displayed if the table has a planning model
assigned. And some of them are only shown at runtime:

Ignore/Enforce Data Locks

This menu entry is displayed at design time and runtime. It is only shown if the table is based on a planning model that
supports backend data locks.

If you click the entry, the button toggles between the two states. By default the data locks are enforced, so Ignore Data
Locks will be shown.

Data Locks

This menu entry is used to display data locks if there are any. It is only displayed at runtime and only if the table is based on
a planning model that supports backend data locks.

Mass Data Entry

This menu entry is only displayed at runtime. It is used to enter data to multiple cells, without causing a round trip. For
more information, see Entering Multiple Values in a Table.

Frontend Cell Locking

This menu entry is only displayed at runtime. It is used to lock cells in the frontend whose values should not change. For
more information, see About Value Lock Management.

Using the Data Action Trigger (Widget)


https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 55/66
8/9/2020
You can use the Data Action Trigger widget from the Insert section of the toolbar to automate planning functions for local planning
models. In the toolbar, click Add Data Action Trigger to open the Data Action Trigger dialog box.

The Data Action Trigger cannot be executed at design time, only at runtime. For more information, see the following chapters:

Data Actions

Creating a Data Action

Using the BPC Planning Sequence (Widget)


You can use the BPC Planning Sequence widget to run planning sequences for BPC live data connection models. This way the
application user can run a planning sequence, which can contain one or more planning functions, as de ned in the BPC system.

You can add theBPC Planning Sequence from the Insert section of the toolbar: In the toolbar, click Add BPC Planning
Sequence to open the BPC Planning Sequence Trigger dialog box. In the dialog box select an existing SAP BPC model and a
planning sequence.

After having added the BPC Planning Sequence, also add a table with the same model as the BPC Planning Sequence to the
application. The planning sequence is applied to the table when the application user clicks on the BPC Planning Sequence widget
at runtime.

The BPC Planning Sequence widget cannot be executed at design time, only at runtime. For more information, see the following
chapter:

Add and Trigger Planning Sequence for a BPC Live Data Connection Model

Using the Toolbar Plan Section at Runtime


The toolbar is displayed in the present (default) mode and view runtime mode of an analytic/planning application. When you open
an application in present mode, at rst you don't see the toolbar. However, when you hover the mouse cursor a the top of the page,
the toolbar appears. To switch to view mode, click the Fullscreen button in the toolbar. In this mode the toolbar is xed and
always displayed in the application.

The Plan section in the toolbar is only shown if there is a planning-enabled table available in the application. If not, the section is
hidden. The planning toolbar buttons are only available at runtime:

Publish Data

For more information, see About Version Management.

Version Management

For more information, see About Version Management.

History

For more information, see About the Version History Panel.

Value Lock Management

For more information, see About Value Lock Management.

Allocate values

There are four ways to allocate values (see Allocations):

spreading a value

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 56/66
8/9/2020
For more information, see Spreading a Value.

distributing a value

For more information, see Distributing a Value.

assigning values

For more information, see Assigning Values.

execute allocation

For more information, see Executing an Allocation Process.

Using the Planning Enabled Property and the


setEnabled API
When you work with planning applications and use a planning model for the table, the table property Planning enabled is active in
the Builder panel.

This property determines whether the table is input-enabled or not.

 Note
If you use BPC live data connections you can switch between read-only and input mode for tables at runtime by using the
table's quick actions menu (Switch to Read-Only Mode and Switch to Input Mode)..

At design time, you can program whether the table should be switched to input or read-only mode with the help of the
setEnabled( API:

If you use the script (for example for a button) Table.getPlanning().setEnabled(false), the table is switched
to read-only mode when the application user clicks the button..

If you use the script Table.getPlanning().setEnabled(true), the table is switched to input mode.

 Note
If you set the setEnabled() API to false, on a table with BPC Live Data Connection with an input-ready query, two cases can
occur:

If no data cells have been changed, the table will be set to read-only and the according locks in BPC will be released.

If data cells have been changed, no publish dialog will be shown. The table will be set to read-only mode and the locks
and the changed data are kept in the BPC System. If the data is published or reverted with the help of APIs, the kept
data is removed, and the BPC locks are deleted.

Working with Predictive Time Series Forecast


in a Table
When working with planning models, you can run predictive time series forecasts on your data within a table.

What you should know


https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 57/66
8/9/2020
A predictive time-series forecast runs an algorithm on historical data to predict future values for a speci c measure in a planning
model.

For enabling the predictive forecasts at runtime you as an application designer have to use a planning model for the table in the
application. Besides you need planning rights and a planning license to run a predictive time series forecast: either SAP Analytics
Cloud for planning, standard edition or SAP Analytics Cloud for planning, professional edition.

At runtime the application user selects a single cell that can be edited and selects the (Predictive Forecast) button in the
toolbar.

Related Information
Predictive Time Series Forecasting
Running a Predictive Time Series Forecast
Features by License Type for Planning Models

Working with Time Series Forecast in a


Chart
A predictive time-series forecast runs an algorithm on historical data to predict future values for a speci c measure in a planning
model.

After adding a time-series forecast chart, you as an application designer can leverage the APIs provided to let end users customize
forecast periods and enable automatic forecast in a line chart. For example:

 Sample Code
Chart_1.getForecast().setType(ForecastType.Auto);

For more detailed information about the API, refer to Analytics Designer API Reference in the SAP Help Portal.

Related Information
Running a Forecast in a Time Series or Line Chart
Features by License Type for Planning Models

Using Explorer and Smart Insights


SAP Analytics Cloud provides powerful tools to let you explore and gain insights into your data. These tools are used in both
stories and analytic applications with some minor differences in usage. Only the usage speci c to the analytics designer is
described here.

Explorer
When you run an analytic application, you can launch the Explorer for a chart or table to select different dimensions and
measures, experiment with lters, and more.

 Note
Before running an application and initiating the explorer, you need to enable the explorer for the charts or tables in the Builder
tab of the Designer panel as you do for an ordinary story.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 58/66
8/9/2020
There are two ways to launch the explorer:

Save the application and choose Run Analytic Application. Just as you do in a story, select the chart, and then select
(Explore).

Leverage the script API to launch the explorer mode in the application to generate charts or tables for data exploring. The
script API can set additional dimensions and measures to the current data source in explorer mode and trigger launching
of explorer. For example:

 Sample Code
//Add Travel_Date and Traveler dimensions to current dimension scope for data exploration.
Chart_1.getDataSource().getDataExplorer().setAdditionalDimensions([“Travel_Date”, “Traveler”])

For more detailed information about the APIs, refer to Analytics Designer API Reference in the SAP Help Portal.

In the Explorer, you see a faceted view of your data, which you can manipulate to generate charts for preview. To be able to save a
chart to a new story directly from the Explorer, select the option Create Story from Widget in the section Quick Menus of the
chart widget's Styling panel when you design the analytic application. You'll then be able to select the icon in the Explorer's
visualization area and choose Create a New Story.

Smart Insights
Smart insights automatically discovers key insights, including correlations, exceptions, clusters, links, and predictions of data, and
brings you straight to the results instead of requiring time-consuming manual data exploration.

In an analytic application, smart insights is only available if Explorer is enabled.

You also need to make sure you have selected Smart Insights in the Quick Menu section of the Styling panel of the corresponding
chart or table widgets.

There are two places you can trigger smart insights for a chart or a table:

After you run the analytic application, trigger smart insights by selecting a data point in a chart or right clicking a data cell
in a table.

After you run the analytic application and enter the Explorer mode of a certain data point, go to the visualization area and
trigger smart insights by selecting a certain data point in the chart or right clicking a data cell in a table.

 Note
You cannot trigger smart insights for charts and tables in a popup.

Furthermore, you can continue to run smart insights with generated data in the smart insights panel or create a story based on the
visualization generated in smart insights if you've enabled creating story for the chart or table widget when designing the
application. To do this, in the Quick Menus section of the chart or table widget's Styling panel, select the option Create Story from
Widget.

Using Smart Discovery


A Smart Discovery is the result generated by running a machine-learning algorithm to uncover new or unknown relationships
between columns within a data set.

In the analytics designer, you can only provide access to Smart Discovery functionality via Script APIs.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 59/66
8/9/2020

APIs to Pre-fill Smart Discovery Dimension and Measure Settings


The APIs to pre- ll Smart Discovery dimension and measure settings include:

data source (mandatory)

selecting the dimensions or measures you want to explore (mandatory)

classi cation groups (mandatory)

version (optional)

singular and plural (optional)

included columns (optional)

page lters (optional)

For more detailed information about the APIs, refer to the component SmartDiscoveryDimensionSettings and
SmartDiscoveryMeasureSettings in Analytics Designer API Reference in the SAP Help Portal.

APIs to Launch Smart Discovery


There are two different ways of using APIs to launch Smart Discovery:

Launching via user interaction events such as clicking a button or selecting a chart. These cause a dialog with the Smart
Discovery URL to pop up. Application users can click it to launch Smart Discovery in a new browser page.

Generating a URL and set the URL to a widget’s hyperlink property. The application users can then click the widget to
launch Smart Discovery in a new browser page. Widgets can be an image, shape, or text.

For more detailed information about the APIs, refer to the component SmartDiscovery in Analytics Designer API Reference in the
SAP Help Portal.

After you trigger Smart Discovery, you will see the Smart Discovery con guration panel displayed and lled with prede ned
settings. Con rm the settings and click Run. Smart Discovery will be automatically executed and display the results in a newly
created story.

Using Search to Insight


Search to Insight is a natural language query interface used to get quick insights about your data.

 Note
In the same way as for a story, the interface can only identify and work with words in English.

Search to Insight displays query results for indexed live HANA data models and acquired data models that you have access to, or
any dimensions that do not have Data Access Control or have granted Data Access Control to you.

In analytics designer, there are two Search to Insight modes:

Simple mode – this is designed for application users with little knowledge of the models behind Search to Insight who want
to perform searches by simply asking questions.

Advanced mode – this is designed for application users who have some knowledge of the models and dimensions behind
the data and want to switch models and select dimensions according to their needs when querying data.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 60/66
8/9/2020

Creating a Search to Insight


You need to create a Search to Insight before you can query data in it.

1. In the Scripting section of the Outline, select right next to Search to Insights to create a Search to Insight.

The side panel Search to Insight opens with a default name of the Search to Insight displayed. You can change the name at
will.

2. In Models to Search, select Add Model to add one or more models you want to query.

 Note
Only models supported by Search to Insight can be added to the Search to Insight component. For live data models,
only indexed live HANA data models are supported. Acquired data models don’t need to be indexed manually. Indexing
is automatically triggered for acquired data models when you perform a query on the models for the rst time.

3. Click Done to nish creating the scripting object.

Related APIs
After adding the widget to the canvas or popup, as an application designer you can leverage the following APIs to open or close a
Search to Insight dialog:

 Code Syntax
//Display the Search to Insight dialog. If the dialog is already open, the query interface and mode
SearchToInsight_1.openDialog(question: string, mode: string, ?cleanHistory:boolean, ?autoSearch: bo

//Can be called by PostMessage API when a Search to Insight dialog is open to close the dialog
SearchToInsight_1.closeDialog(): void;

You can also apply search to insight results to a chart using applySearchToChart() API and leverage the following variable related
APIs to save variable value in a Search To Insight component and apply to chart when calling applySearchToChart():

 Code Syntax
//get model variable
SearchToInsight_1.getVariables(modelId: string): VariableInfo[]

// set model variable


setVariableValue(modelId: string, variable: string|VariableInfo, variableValue: string|number|Varia

// Search by input question within selected search to insight model and apply the results to a char
SearchToInsight_1.applySearchToChart(question: string, chart: chart): boolean

Example 1: Trigger Different Modes of Search to Insights

 Example
In this example, you can design a simple application to let application users trigger different modes of Search to Insight for the
questions they enter.

First, in addition to the scripting object SearchToInsight_1, add an input eld (InputField_1), a button (Button_1)
and a checkbox group (CheakboxGroup_1) to the Canvas as below:

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 61/66
8/9/2020
Then write the following script for the button widget Button_1:

 Sample Code
var mode = SearchToInsightDialogMode.Simple;
if (CheckboxGroup_1.getSelectedKeys().length !== 0)
{
mode = SearchToInsightDialogMode.Advanced;
}
var inputText = InputField_1.getValue();
SearchToInsight_1.openDialog(inputText, mode, false, true);

Result: After you save the application and choose Run Analytic Application, application users can either trigger simple mode by
entering a question and clicking the Search to Insight button, or trigger advanced mode by entering a question, selecting the
Advanced mode, then clicking the Search to Insight button.

Example 2: Receive Question from Host HTML Page and Apply Search to Insight Results to a Chart

 Example
In this example, you can build your own search to insight user interface and integrate search to insight results to your own
portal.

First, embed your analytic application in your own portal via iFrame and maintain corresponding code to get the message users
input in the portal and post it to the embedded analytic application.

Then go back to the analytic application, besides adding the scripting object SearchToInsight_1, write the following script
for the onPostMessageReceived event of the application:

 Sample Code
SearchToInsight_1.applySearchToChart(message, Chart_1);
Chart_1.setVisible(true);

Result: After that in your own portal, users can ask a question and see the chart of the embedded analytic application appear
and display corresponding search to insight results.

Using OData
You can de ne OData Services in SAP Analytics Cloud, analytics designer based on an existing on-premise SAP S/4HANA live
connection in your system which was created using CORS (Cross-origin resource sharing) connectivity. Additionally, you can also
de ne OData Services based on SAP BW systems, SAP HANA systems, and SAP Business Planning and Consolidation (BPC)
systems (that were also created using CORS).

You can create an OData service, de ne the endpoint URL and trigger the execution of the action by using scripts.

OData services can be used to trigger transactional actions at the backend like lling out an order form or other forms.

In analytics designer, OData actions can be called from and executed in the backend system via scripting inside an analytic
application. Furthermore, it is also possible to read and use the data of entity sets (exposed via OData services) by using APIs.

What you should know


https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 62/66
8/9/2020
OData actions are operations exposed by an OData service that may have side effects when invoked.

OData action imports, also called unbound actions are not associated with any OData entity set or entity. They generally
expose simple parameters. All parameters are set via POST body.

OData bound actions are actions which may be invoked on a speci c entity. They always contain a rst parameter which is
set via URL (to resolve the binding to the entity within the relevant entity set), and all other parameters are set via POST
body.

In general, actions can be bound on every type, but in analytics designer only binding on single entities is supported.

For OData you should con gure the CORS (direct) connection at the backend. Please follow the instructions for the
connection con guration in this chapter Live Data Connections to SAP S/4HANA.

In the documentation chapter for the connection con guration (see link above) the CORS connection is referred to as
direct connection.

 Note
Note the following important additional con guration information:

The service path that you con gure should correspond to the end-point URL of the OData service.

In addition to the service path listed in the documentation, you need to add another service path:
/sap/opu/odata4/

The connection should also support if-match as allowed header.

Note the following limitations:

Only parameters of simple types are supported. Actions with mandatory parameters of unsupported types are not
available. For actions with optional parameters of unsupported types, the action itself is supported but those parameters
are not.

In case of bound actions, actions which are bound to an entity collection are not supported. Only actions which are bound
to a single entity are supported. It is only possible to set this binding parameter by specifying the key of the entity on which
the action should be carried out.

Only the JSON format is supported

Only S/4HANA on-prem is supported

Only Direct (CORS) connections is be supported.

The following types are not supported:

Edm.Stream

Edm.Untyped

all Edm.Geography types

all types de ned in different name space

Related Information
Adding an OData Service
Example 1: Using OData Actions in an Application
Example 2: Using OData Actions in an Application
Reading Data from OData Services

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 63/66
8/9/2020

Adding an OData Service


To execute an OData action, you must rst add an OData service with the corresponding actions to your application.

Prerequisites
Have ready the end-point URL of the OData service. You'll need to enter it manually when creating the service.

Procedure
1. In the Scripting section of your analytic application, click (Add OData Services).

A new entry with the default name ODataService_1 appears below the OData Services node. A side panel opens on the
right.

2. In the side panel, do the following:

a. Change the default name of the new service to a meaningful name, if you want.

b. Select the system from the list of available SAP S/4HANA systems whose connections were already created in SAP
Analytics Cloud under Connections.

c. Manually enter a valid end-point URL of the OData Service, in the format /some/end_point/url/.

You need to know the URL because there is no browse catalog available.

3. Click the refresh button next to Metadata to review the metadata of the new OData service.

4. Click Done to close the panel.

Results
Now you can use the OData action. For further information, please see Example 1: Using OData Actions in an Application

Related Information
Using OData
Example 2: Using OData Actions in an Application

Reading Data from OData Services


With OData services you not only can access OData actions, but also read and use the data of entity sets exposed via OData
services.

This lets you use the data of the entity sets for any purpose except data visualization in a table or a chart. For example, you can
read and display one member in a text widget. To access entity sets exposed via OData Services, you can use two APIs in your
script:

getEntity: for retrieving a single OData entity from an entity set, by specifying the key to the entity. This is similar to
selecting a single row from a SQL table via SELECT * FROM T1 WHERE ID = <id>.

getEntitiesFromEntitySet: for retrieving all entities from an OData entity set. This is similar to SELECT TOP <N> *
FROM T1. With this API you can use the OData system query options filter, orderby, select, count, top and skip.

 Note
The number of entities is limited to 1000 if no system query options have been used. If system query options are set,
the number of retrieved entities is not limited, unless you set a value for the system query option top. top.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 64/66
8/9/2020

getEntitiesCountFromEntitySet: for retrieving the number of entities from an OData entity set. This API works
like the getEntitiesFromEntitySet API and you can also use the OData system query options filter, orderby,
select, count, top and skip.

 Example
The parameters lter, orderby, and select have string values which will be 1:1 used in the OData request. This allows you to use
all features supported by the query options. The parameters skip and top have integer values, that will be used in the OData
request. The second parameter in both API methods is passed as object, in which the system query options can be combined
in an arbitrary way.

 Sample Code
// returns a list of entities, filtered by the given system query option(s)
ODataService_1.getEntitiesFromEntitySet("Departments", {filter: "contains(Sector,'Consulting')", or
// returns a list of entities, not filtered
ODataService_1.getEntitiesFromEntitySet("Equipments");
// returns the number of entities in the entity set "TEAMS"
ODataService_2.getEntitiesCountFromEntitySet("TEAMS");
// returns the number of entities in the entity set "EMPLOYEES", filtered by the given system query
ODataService_2.getEntitiesCountFromEntitySet("EMPLOYEES", {skip: 5, top: 10});

 Note
When you want to read data from OData services, note the following feature limitations:

chaining from one entity set to another is not supported

expand (analogous to joining) is not supported

entity sets with parameters are not supported

entity sets with mandatory lters are not supported

Using the Toolbar in Runtime Mode


The toolbar is displayed in the present (default) mode and view runtime mode of an analytic/planning application.

When you open an application in present mode, at rst you don't see the toolbar. However, when you hover the mouse cursor at
the top of the page, the toolbar appears. To switch to view mode, click the Display button in the toolbar. In view mode the
toolbar is xed and always displayed in the application.

The toolbar has several sections:

data section

The Data section is always shown and contains two toolbar buttons, which are also available during design time.

Refresh data

Edit Prompts

display section

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 65/66
8/9/2020
The Display section is always shown in present and view mode. It contains the (fullscreen) button, which is not available
during design time.

plan section

The Plan section is only shown if there is a planning-enabled table available in the application. If not, the section is hidden.
See Working with Planning Applications.

ul

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20087850&topics=25a3b8d145864d7faf7447b916… 66/66

You might also like