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.
In the following example, the
CustomerName and
CustomerPropensity arrays are being displayed in the same table.
CustomerName is indexed by
(CUSTOMERS) and
CustomerPropensity is indexed by
(CUSTOMERS, CHANNELS). The
CHANNELS set is fixed 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> </vdl-table>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. An example:
<vdl-table page-mode="paged" page-size="10" width="400"> <vdl-table-column entity="CustomerName"></vdl-table-column> <vdl-table-column entity="CustomerPropensity" vld-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.