In the previous blog in this series, we learnt how to utilize planning script functions. In this blog, let us discuss commenting in Analytics Designer.

* * *

Widget Commenting

Like Story, users can enter comments in Analytic Applications for each widget. These comments are specific to the Analytic Application. Since comments are not enabled by default, you need to enable the option under Quick Menus in Styling Panel.


Once enabled, users will be able to add, delete and like comments provided they have appropriate privileges. Here you can see the Widget Level Commenting in action below.

Data Point Commenting

For both Story and Analytic Application, data point commenting or table cell commenting is only possible for planning enabled models. Unlike widget comments, data point comments can be accessed across different Stories and Analytic Applications as long as you have the same filters in the table. Here you can see Data Point Commenting in action below.

Commenting with Script Functions

Apart from accessing data point comments from table widget, you can also access the comments from script functions. Here you can see Data Point Commenting using script in action below.

In the above example, users will be able to enter comments for their profit center without the need for a table widget. A text box displays all existing data point comments of their profit center. Once the comments are added using the script, they can be accessed from any Story or Analytic Application. Below is the snapshot of a table widget in a different Story showing comments entered from Analytic Application scripting.

Let us see how to implement the commenting functionality using a script in detail below.

1. Table Widget is a Prerequisite

Datapoint comments can be accessed using scripting only if you have a Table widget that is linked to the planning model. You can hide the table from the user and still access the comments using the script. The snapshot below shows the hidden table with profit centers on rows and Account dimension in columns. You will be able to add comments to any data cell using the script.

2. Setting up the Widgets

Widgets Text Box, Input Field and Button are added. When a user runs the application, comments for his/ her profit center must be populated in the text box. The users can add new comments to their profit center with the help of Input Field and Button.

3. Populating Existing Comments

The script to populate any existing comments can be added to the onInitialization event.

Here the appropriate profit center is assigned to a script variable upon checking the current user ID. Then all the comments for that profit center cell are obtained using the function getComments(). The comments are concatenated into a single string and then applied to the text box. The string “\n” forces a line break within the text box.

4. Adding New Comments

In the onClick event of the button, the following script can be added which enables the user to add a new data point comment.

The function addComment() adds a new data point comment to the table cell which is specified in the form of Selection. The function also returns the details of the newly added comment which is stored in a local variable. The comment information is then concatenated with the existing string of the text box to refresh the comment feed. The function createdAt() returns the time of addition of comment and the function createdBy().displayName returns the Author of the comment (the current user). Finally, the value of the Input Field is reset so that the user can enter new comments.

In the next blog in the series, we will discuss Bookmarking in Analytics Designer.

Click here to evaluate if SAP Analytics Cloud is right for you. To know about the Analytic Applications of SAP Analytics Cloud, please check out our blog series here.

Subscribe to our Newsletter

5920 Windhaven Pkwy
Plano TX 75093.

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192