Using a Pivot Table
[
{ key: [1, 1, 'UK'], value: 100},
{ key: [1, 2, 'USA'], value: 200},
{ key: [1, 2, 'FR'], value: 300},
...
]
VDL actions can be used to fetch, group, aggregate, and label data.
<vdl-var name="groupedData" value="=[]"></vdl-var>
<vdl-var name="indexSetNames" value="=[]"></vdl-var>
<vdl-var name="labelArrays" value="=[]"></vdl-var>
<vdl-action-group name="getData">
<vdl-action-get-entity-data entity="CountryStats"></vdl-action-get-entity-data>
<vdl-action-group-by set-position="=[2,0,1]"></vdl-action-group-by>
<vdl-action-aggregate></vdl-action-aggregate>
<vdl-action-set-var var="groupedData"></vdl-action-set-var>
<vdl-action-get-index-sets entity="CountryStats"></vdl-action-get-index-sets>
<vdl-action-set-var var="indexSetNames"></vdl-action-set-var>
<vdl-action command="getLabelArray" vdl-repeat="=name in vars.indexSetNames" value="=name"></vdl-action>
</vdl-action-group>
<vdl-action-group name="getLabelArray">
<vdl-action-get-entity-data entity="=value" with-labels="true"></vdl-action-get-entity-data>
<vdl-action-array-push var="labelArrays"></vdl-action-array-push>
</vdl-action-group>
<vdl-pivottable
data="=vars.groupedData"
row-dimensions="=['Match']"
column-dimensions="=['Country', 'Stat']"
column-titles="=[vars.labelArrays[0],vars.labelArrays[1]]"></vdl-pivottable>
Pivot table attributes
Attribute | Description |
always-show-selection |
Whether to display selection on inactive tables. Set to true to keep selection on a table when it becomes inactive. |
class |
Space-separated list of the classes of the element. |
column-dimensions |
Used to define the dimensions pivoted onto the columns. Supported format: An array of column group headings |
column-set-position |
The position of the keys that are used to produce the columns of the pivot table. You can specify a single value or an array. For example: |
column-titles |
An array of arrays used to decorate the column titles, supported formats are; Array of strings |
data |
Use this attribute to pass data directly to vdl-pivottable. Supported formats: Array of key/value objects: |
height |
Table height. When page-mode is set to scrolling, you can set the height of the table to something other than the default. |
id |
Specify an element id for the table. Useful if you later want to target the table using a selector. If not given then an id will be generated. |
page-mode |
By default the table will show all rows in scrolling mode. Set this attribute to paged to enable table pagination. |
page-size |
The number of rows to show per-page in paged mode. |
row-dimensions |
Used to define the dimensions pivoted onto the rows. Supported format: An array of row group headings |
row-filter |
Expression to be used for filtering the rows of a <vdl-pivottable>. This must be an expression and should resolve to either a function or a boolean value. If a function it will be executed when the table updates. The function will have the following signature (rowData, indices) and should return a boolean.
|
row-set-position |
The position of the key or keys you wish to pivot onto the rows. You can specify a single value or an array. For example: |
row-titles |
An array of arrays used to decorate the row titles, supported formats are; Array of strings |
show-column-calc |
Display a calculated cell displaying the total for each column. |
show-row-calc |
Display a calculated cell displaying the total for each row. |
width |
Set the table to a fixed width in pixels. Accepts an integer value. If set to the string custom then the table width is calculated by adding up all the widths of the columns in the table. If a column doesn't have a width specified, then it is given a default value of 100px. |
© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.