vdl-action-group-by
Group data by one or more of its keys and return a new array of objects in the format: single dimension grouping: [ { key: "key", values: ["values"] }], multi dimensional grouping: [ { key: ["key1", "key2"], values: ["values"] }]
since 4.8Required parent element
Example
<!-- single dimension grouping using vdl-action-group-by (default values) with vdl-action-get-entity-data-->
<vdl-action-group name="getGroupedData">
<vdl-action-get-entity-data entity="myEntity"></vdl-action-get-entity-data>
<!-- example output [
{key: ["revenue", "1"], value: 100},
{key: ["revenue", "2"], value: 200},
{key: ["revenue", "3"], value: 300},
{key: ["cost", "4"], value: 400},
{key: ["cost", "5"], value: 500},
{key: ["cost", "6"], value: 600}
] -->
<vdl-action-group-by></vdl-action-group-by>
<!-- output = [
{ key:"revenue",
values:[
{key:["revenue","1"],value:100},
{key:["revenue","2"],value:200},
{key:["revenue","3"],value:300}
]
},
{ key:"cost",
values:[
{key:["cost","4"],value:400},
{key:["cost","5"],value:500},
{key:["cost","6"],value:600}
]
}
] -->
</vdl-action-group>
<!-- multidimensional grouping using vdl-action-group-by with vdl-action-get-entity-data-->
<vdl-action-group name="getGroupedData">
<vdl-action-get-entity-data entity="myEntity"></vdl-action-get-entity-data>
<!-- example output [
{key: ["revenue", 1, "A"], value: 100},
{key: ["revenue", 2, "A"], value: 100},
{key: ["revenue", 1, "B"], value: 100},
{key: ["revenue", 2, "B"], value: 100},
{key: ["cost", 1, "A"], value: 100},
{key: ["cost", 2, "A"], value: 100},
{key: ["cost", 1, "B"], value: 100},
{key: ["cost", 2, "B"], value: 100}
] -->
<vdl-action-group-by set-position="=[0,1]"></vdl-action-group-by>
<!-- output = [
{ key: ["revenue", 1],
values: [
{key: ["revenue", 1, "A"], value: 100},
{key: ["revenue", 1, "B"], value: 100}]
},
{ key: ["revenue", 2],
values: [
{key: ["revenue", 2, "A"], value: 100},
{key: ["revenue", 2, "B"], value: 100}]
},
{ key: ["cost", 1],
values: [
{key: ["cost", 1, "A"], value: 100},
{key: ["cost", 1, "B"], value: 100}]
},
{ key: ["cost", 2],
values: [
{key: ["cost", 2, "A"], value: 100},
{key: ["cost", 2, "B"], value: 100}]
}
] -->
</vdl-action-group>
<!-- adding groups via the default-keys attribute -->
<vdl-action-group name="getGroupedData">
<vdl-action-get-entity-data entity="myEntity"></vdl-action-get-entity-data>
<vdl-action-group-by default-keys="=['Profit']"></vdl-action-group-by>
<!-- output = [
{ key:"revenue",
values:[
{key:["revenue","1"],value:100},
{key:["revenue","2"],value:200},
{key:["revenue","3"],value:300}
]
},
{ key: "Profit",
values: []},
{ key:"cost",
values:[
{key:["cost","4"],value:400},
{key:["cost","5"],value:500},
{key:["cost","6"],value:600}
]
}
] -->
</vdl-action-group>
Attributes
data | The data which is to be grouped. If the data attribute is not set then the current value from the VDL action group will be used. | since 4.8 | accepts expression | |
---|---|---|---|---|
default-keys | The keys in this array will always be present. Required format is an array, duplicates will be removed. | since 4.8 | requires expression | |
set-position | The position of the key or keys you wish to group data by. You can specify a single value or an array. For example: key[x,y,z] to sort by y set-position="1", or to sort by z and x set-position="=[2,0]" The default value is 0. When sorting by multiple keys, the returned group property will be an array. | since 4.8 | accepts expression |
© 2001-2025 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.