Initializing help system before first use

Index Filtering

If you need to display multiple arrays in the same table, but one or more of the arrays have additional indices, you need to filter the data by specifying fixed values for the additional indices.

This is done using one or more <vdl-index-filter> elements within a <vdl-table-column> element.

Using the View Designer

You must have a Table placed on the artboard which has a configured Table Column.
  • In the Palette > Components group, click and drag an Index Filter element onto the Table Column.
  • Select the Index Filter element on the artboard, and in the Attributes pane:
    • Edit the Data > SET attribute to select the Set.
    • Edit the Value attribute to specify the value to display in the table column.

Using the Code editor

In the following example:
  • the CustomerName and CustomerPropensity arrays are displayed in the same table.
  • CustomerName is indexed by (CUSTOMERS).
  • CustomerPropensity is indexed by (CUSTOMERS, CHANNELS).
The data is filtered by fixing the CHANNELS set to 1 for the CustomerPropensity column.
<vdl-table page-mode="paged" page-size="10" width="400">
	       <vdl-table-column entity="CustomerName"></vdl-table-column>
        <vdl-table-column entity="CustomerPropensity" heading="Propensity (SMS)">
            <vdl-index-filter set="CHANNELS" value="1">
            </vdl-index-filter>
</vdl-table-column>
Another use for index filtering is to pivot one of the indices of an array as extra table columns. This is achieved by repeating the column for each element in the set, and using the index filter to fix the value for that index. This is shown in the following example:
<vdl-table page-mode="paged" page-size="10" width="400">
    <vdl-table-column entity="CustomerName"></vdl-table-column>
    <vdl-table-column entity="CustomerPropensity" 
                      vdl-repeat="=c in scenario.entities.CHANNELS"
                      heading="='Propensity (' + c.label + ')'">
        <vdl-index-filter set="CHANNELS" 
                          value="=c.value">
        </vdl-index-filter>
    </vdl-table-column>
</vdl-table>
In the headings of the generated columns, the label for the channel is used, whereas for the index filter, the value is used.