Working with the Comment Widget in an Analytic Application

You can now add a comment widget to canvas to gather and manage table data cell comments in analytic applications. When bound to the same data source and restricted to the same data cells, table cell comments are synchronized to comment widgets.

Context

Both analytic and planning models are supported.

Filter line isn't supported. Filters of an analytic application opened from calendar tasks aren't supported as well.

Procedure

  1. Click and from More Widgets, select and add a comment widget to the canvas.
  2. In the Builder Panel of the comment widget, configure data source.
  3. Define filters to specify the relevant data cells of a comment widget.
    Note

    In design time, the comment widget is read only.

    You can also use the following APIs to set, get or remove filters in comment widgets:

    Code Syntax
    setDimensionFilter(dimension: string | DimensionInfo, member: string | string[] | MemberInfo | MemberInfo[] | MeasureInfo | MeasureInfo[] | TimeRange | TimeRange[])
    getDimensionFilters(dimension: string | DimensionInfo) : FilterValue[]
    removeDimensionFilter(dimension: string | DimensionInfo)
    

    Here’s a script example that shows how to make a comment shown in a specific comment widget and copy a filter from table to it.

    Example

    Write the following script to show the comment in comment widget (CommentWidget_1) when 2021 is selected under the filter Date:

    Sample Code
    CommentWidget_1.getCommentingDataSource().setDimensionFilter("Date_703i1904sd", "[Date_703i1904sd].[YHM].[Date_703i1904sd.YEAR].[2021]");

    Furthermore, write the following scripts to copy the filter Location from Table_1 to CommentWidget_1:

    Sample Code
    var filter = Table_1.getDataSource().getDimensionFilters("Location_4nm2e04531")[0];
    if (filter.type === FilterValueType.Single) {//Table_1 has dimension filter "Location=SA1"
        var singleFilter = cast(Type.SingleFilterValue, filter);
        CommentWidget_1.getCommentingDataSource().setDimensionFilter("Location_4nm2e04531", singleFilter.value);
    } else if (filter.type === FilterValueType.Multiple) {//Table_1 has dimension filters "Location=SA1" or "Location=SA2"
        var multipleFilter = cast(Type.MultipleFilterValue, filter);
        CommentWidget_1.getCommentingDataSource().setDimensionFilter("Location_4nm2e04531", multipleFilter.values);
    }
    

Results

All relevant table cell comments of the same data range will be displayed in the comment widget.

In runtime, an application user can add new comments, delete existing comment or like a comment directly in the comment widget. The changes will be automatically updated to the corresponding table. On the other hand, when application users add a data point comment to the table, it will also show up in the widget as the comments are attached to the data points stored within the model.

The comment widget supports all the existing comment APIs. Table cell comment edited by APIs will be synchronized to the comment widget as well.