Add Comment Widgets to Your Analytic Applications

As an application designer, you can add a comment widget to the canvas to gather and manage table data cell comments in your analytic applications. When bound to the same data source and restricted to the same data cell, table cell comments are synchronized with comment widgets.

Context

Both analytic and planning models are supported.

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

Procedure

  1. From the toobar select Start of the navigation path Next navigation step More Widgets Next navigation step Comment WidgetEnd of the navigation path to add a comment widget to the canvas.
  2. In the Builder panel of the comment widget, configure a data source.
  3. Define the filters to specify the relevant data cells of a comment widget.
    Note

    In design time, comment widgets are 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)
    
    Example

    Here’s a script example that shows how to make a comment shown in a specific comment widget and apply the same filter as table to it.

    Write the following script to display the comments in CommentWidget_1 when 2021 is selected in the filter Date:

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

    Furthermore, write the following script 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.

At runtime, application users can add new comments, delete and like an existing comment directly in the comment widget. Changes will be automatically updated to the corresponding data cells. On the other hand, after application users add a data point comment to the table, it may also show up in the comment widget when relevant filters are applied.

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