Among the numerous new features that SAP Lumira Designer 2.1 offers, Application level commentary has been a highly awaited add-on. Available as a technical component, this feature allows the users to collaborate by entering comments into the application at runtime.
 

Prerequisites

This blog is a follow up to our overview blog on the Commentary feature published earlier and focuses entirely on the technical aspects of implementing the Commentary feature. Hence, requires the reader to possess basic knowledge of SAP Lumira Designer including scripting. It is also assumed that:

  1. Installation and Database configuration of BI Commentary Application on CMC has already been done
  2. User security implementation on BI Platform has been set up

 

Implementation

Once configured, we are now ready to leverage the power of Commentary in our SAP Lumira Designer application. It begins with adding the ‘Comments’ technical component to the outline of the application.

Implementation of Commentary
 

A comment has the following parameters associated with it:

ContentComments entered by the user
PrivacySpecifies whether the content entered by the user should be private to the owner (Private) or should be visible to all the authorized users of the application(Global). The ability to delete/update comments created by other users is dependent on the object/folder level security settings defined on the BI platform.
Context TypeThis defines the part of the application that the comment is tied to

1. No Context – General comments tied to the comments component.

2. Context – Comments are tied to the filters applied to a specific list of dimensions in the data source.

3. Dimension – Comments are tied to a dimension in the table.

4. Member – Comments appear against a particular member of the dimension.

5. Data cell – Comments are tied to a particular data cell in the table.

DatasourceSpecifies the datasource that the comments are tied to. Not a pertinent parameter for comments of type ‘No Context’.
ContextSpecifies the data cell to which the comments are tied. Not a pertinent parameter for comments of type ‘No Context’.

 

 

Comments without context

These comments are not linked to any part of the dashboard. In addition to the ‘Comments’ technical component, we require

  • Feed list – to populate the comments
  • Text area – to get the inputs from the user

 

Adding comments

The comment entered by the user in the text area is used as the content of the comment created. The context type is specified as NONE and the privacy properties is specified based on user selection. The following code is used to add comments without context:

Commentary Blog- Adding comments

Adding comments works both locally and on the BI platform; Comments added in local mode get added to the local repository, the comments in BIP mode get stored in the audit/pre-configured commentary database.
 

Updating comments

The comment ID selected from the feed list is retrieved and is updated with the content from the Text area. The corresponding feed list is reloaded with the updated comments. The following piece of code would do the trick:

Commentary-Updating Comments
 

Delete comments

The comment ID selected from the feed list is retrieved and is deleted. The corresponding feed list is reloaded to exclude obsolete comments.

Commentary- Deleting Comments
 

Sorting the comments

Comments could be sorted by adding two parameters – ‘sortBy’ and ‘Order’ to getComments() before populating the feed lists. The comments could be sorted in

  • Ascending (or)
  • Descending

Based on

  • Last Modified date (or)
  • Created date

Commentary Blog

By default, the comments are sorted in ascending order based on last modified date.
 

Changing the Privacy

The same piece of code can be reused for creation, update and deletion of public and global comments. The only distinction between the two privacy settings is the Boolean value passed to the “isPublic” parameter.

  • ‘true’ corresponds to Global comments – Users will be able to view/modify/ delete the comments created by other users in the application (Dependent again on the BI platform user rights).
  • ‘False’ corresponds to Private comments – Users will be able to view/modify/ delete the comments created by them.

 
Commentary Blog- Changing the Privacy
 

Comments in a Crosstab

Comments can be added to different areas in the crosstab by adding parameters ‘context’ and ‘context type’ to the comments during creation. Comments can be added to the following area of the crosstab:

  1. Dimension
  2. Dimension Member
  3. Data cell

Commentary Blog- Comments in Crosstab

To add comments to the crosstab, we need the technical component ‘Context menu’ in addition to the components used in the above example.
 

Setting up the context menu

Each application has a ‘Context menu’ component by default in the technical component section. Add a custom menu entry called ‘Comments’ to the context menu. In the scripting section corresponding to the menu entry,

  • we store the selection type and selection from the context menu in global variables (of type String and Result set selection by string respectively)
  • open up the commentary panel
  • load all the comments corresponding to the context into the feeding panels

The global variables (selection type and selection) are used while creating and accessing the comments.

Commentary Blog- Script for Context Meny Entry
 

Adding/Updating/Deleting the comments

The only addition to the existing scripts is the addition of ‘context’ and ‘context type’ as follows:

Commentary Blog- Adding/Updating/Deleting the comments

Similar alterations to Update and Delete are to be made

Commentary Blog- Update and Delete

Make sure that the crosstab has ‘comments visible’ property set to true

Commentary Blog-Picture

In Runtime, the cells with comments will be highlighted as follows and hovering over the cell will show the latest comment in that cell.

Commentary Blog Image

The behavior in runtime is as follows:

Commentary Blog- Behavior in runtime
 

Comments on a set of filters

To set comments on a list of filters, we need to have ‘datasource’ parameter in addition to context, context type and privacy.
 

Computing the context

Whenever a filter is applied to the data source, the context parameter is calculated and all the comments tied to the context parameter are repopulated in the feed. The context parameter is structured in the following format:

{ “dimesion1”: [“member1”,”member2”,”member3”],

“dimesion2”: [“memberA”,”memberB”,”memberC”]}

The following script will compute the context and this has to triggered every time a new filter is applied on the datasource. The computed context is stored in a global variable for future usage.

Commentary Blog- Computing the context
 

In the ‘On Result set changed’ event of the datasource, the context is computed and all the pertaining comments are loaded into the feed lists

Commentary Blog- context is computed
 

Add/Update/Delete

The context type is to be changed to DATA and the context is to be mapped to the global variable containing the recomputed context.

Commentary Blog- Add/Update/Delete
 

Commentary Blog- Add/Update/Delete
 

Exporting to PDF

  • Add the technical component ‘Export to PDF’ to the layout
  • Enable the following properties in the export to PDF component

Commentary Blog- Exporting to PDF

  • To view the comments in a crosstab in the exported document, enable the following property through scripting.
  • Commentary Blog- Export to PDF

  • Add the crosstab that has to be exported along with its comments to the components tab of the PDF component.
  • Commentary Blog- Exporting to PDF

  • Use EXPORT_PDF.exportReport() to export contents of the crosstab along with comments. The comments show up in the appendix section of the exported PDF document.

Commentary Blog- Appendix
 

Usage in composites

Comments can be shared between applications by implementing commenting functionality in a composite. This way, both the applications will access the same technical component for creation/deletion/update.

  • Use comments of context type “None” if all the comments created in both applications are to be shown in both applications.
  • Use comments of context type “context” and use App ID as context to access comments created in the application of the specified App ID alone.

Commentary Blog- Usage in Composites

Watch out for this space for a detailed blog on inter-application commentary.

Subscribe to our Newsletter

5920 Windhaven Pkwy
Plano TX 75093.

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com