Initializing help system before first use

# Data Transformation Actions

Use the data transformation VDL actions to get, label, aggregate, and filter data.
The data transformation actions can be used to manipulate and visualize data. For more detail on each action, see the VDL reference documentation for each action. The data transformation actions are:

- Get index sets: `<vdl-action-get-index-sets>`
- Get entity data: `<vdl-action-get-entity-data>`
- Group data by: `<vdl-action-group-by>`
- Label data: `<vdl-action-add-labels>`
- Aggregate data: `<vdl-action-aggregate>`
- Filter data: `<vdl-action-filter>`
- Set var: `<vdl-action-set-varvar="scenarioData">`

## Get and filter data

Use `<vdl-action-get-index-sets>` to determine the index sets associated with a supplied array. It should be used as shown:

    <vdl-action-get-index-sets entity="CountryStats"></vdl-action-get-index-sets>

Entity data can be fetched using the `<vdl-action-get-entity-data>` action. Use the entity attribute to return the entity data as an array of primitives, as shown below:

    <vdl-var name="example1Data" value="=[]"></vdl-var>
    <vdl-action-group name="example1">
        <vdl-action-get-entity-data entity="StatTypes"></vdl-action-get-entity-data>
        <vdl-action-set-var var="example1Data"></vdl-action-set-var>
    </vdl-action-group>

    <vdl-button label="Get Set Data" vdl-event="click:actions.example1"></vdl-button>
    <ul>
        <li vdl-repeat="=data in vars.example1Data"><span vdl-text="=data"></span></li>
    </ul>

Array data can be returned for multiple scenarios by using the scenario attribute to fetch a filtered array for each scenario, then summing each result with `vdl-action-aggregate`, as shown below:

    <vdl-var name="currentScenarioIndex" value="0"></vdl-var>
    <vdl-var name="example4Data" value="=[]"></vdl-var>

    <vdl-action-group name="example4">
        <vdl-action-set-var var="example4Data" value="=[]"></vdl-action-set-var>
        <vdl-action command="example4FetchByScenario" vdl-repeat="=s, indx in scenarios" value="=indx"></vdl-action>
    </vdl-action-group>

    <vdl-action-group name="example4FetchByScenario">
        <vdl-action-set-var var="currentScenarioIndex"></vdl-action-set-var>
        <vdl-action-get-entity-data
            entity="CountryStats"
            filters="={'StatTypes':['1'], 'CountryCodes':['UK']}"
            scenario="=vars.currentScenarioIndex"></vdl-action-get-entity-data>
        <vdl-action-aggregate></vdl-action-aggregate>
        <vdl-action-array-push var="example4Data" value="={value:value, label:scenarios[vars.currentScenarioIndex].props.name}"></vdl-action-array-push>
    </vdl-action-group>

    <vdl-datagrid vdl-if="=vars.example4Data.length" column-definition="labels" data="=vars.example4Data"></vdl-datagrid>

## Define variables and aggregate data

The `vdl-action-group-by` Action takes groups entity data by one or more keys. Each object in the data must have a key property, defined as an array of primitives.

Group by a single dimension

When grouping by a single key, the `vdl-action-group-by` Action creates a new object (group) for each key. The object contains two properties, the key, and an array containing all of the rows with the unique key at the designated set position.

To group by a single dimension you must define the data to be used, and the set-position to group by. This example stores the result in the VDL Var, before defining VDL buttons to change which set-position is used to group the data. Data is returned as an array of objects. Each object has a key and values property. The key will be a primitive and the values property will be an array containing the data objects for that group.

    <vdl-var name="exampleData" value="=[]"></vdl-var>

    <vdl-action-group name="example">
        <vdl-action-group-by data="=data" set-position="=value"></vdl-action-group-by>
        <vdl-action-set-var var="exampleData"></vdl-action-set-var>
    </vdl-action-group>

    <vdl-button label="Group source data by set-position 0" value="0" vdl-event="click:actions.example"></vdl-button>
    <vdl-button label="Group source data by set-position 1" value="1" vdl-event="click:actions.example"></vdl-button>

Group By multiple dimensions

When grouping by multiple keys the object will contain an array of the keys used to group the data, and an array containing all the rows with the unique key at the designated set-position. You must enter the set-position as an array, for example:

    <vdl-action-group-by data="=vars.example1Data" set-position="=[0,1]"></vdl-action-group-by>

Using default keys

You can ensure that the results of `vdl-action-group-by` will always contain specific keyed groups or objects by using the `default-keys` attribute. Keys that are passed to `vdl-action-group-by` will always be displayed, but `default-keys` can be used to force a key to be displayed even if there are no data rows containing that key to be displayed.

If keys passed in `default-keys` exist in the data, they will not be duplicated.

Default keys are defined as shown below:

    <vdl-action-group-by data="=example2Data" set-position="1" default-keys="=[1,2,3,4,5]"></vdl-action-group-by>

Data is returned as an array of objects. Each object has a key and values property. The key will be an array of primitives, and the values property will be an array containing the data objects for that group.

## Label the data

Use the `<vdl-action-add-labels>` action to add a labels property to an object. In the following examples, the fetched data is set via `<vdl-action-set-var>` into a VDL variable.

To add a label, pass an array to `data` and an entity name to `annotated-entity`. This returns an array of objects containing a value and label for each item in the array.

    <vdl-var name="example1Data" value="=[]"></vdl-var>
    <vdl-action-group name="example1">
        <vdl-action-add-labels data="=[2,3,4]" annotated-entity="StatTypes"></vdl-action-add-labels>
        <vdl-action-set-var var="example1Data"></vdl-action-set-var>
    </vdl-action-group>

    <vdl-button label="Add Labels to [2,3,4]" vdl-event="click:actions.example1"></vdl-button>

    <vdl-datagrid vdl-if="=vars.example1Data.length" data="=vars.example1Data"></vdl-datagrid>

Fallback labels can be used to add labels to any data that is not otherwise labelled. To create a fallback label, pass an array of objects to `data`, and entity name to `labels-entity`, using the `fallback-label` attribute to specify which property to use when there is no label. This returns an array of objects containing a value and label for each item in the array.

    <script>
    const example3PassedData = [
        {key: 'UK', value:'100'},
        {key: 'FR', value:'200'},
        {key: 'IT', value:'300'},
        {key: 'USA', value:'400'},
        {key: 'IRL', value:'500'},
        {key: 'ESP', value:'600'},
    ];
    </script>

    <vdl-var name="example3aData" value="=[]"></vdl-var>
    <vdl-var name="example3bData" value="=[]"></vdl-var>

    <vdl-action-group name="example3">
        <vdl-action-add-labels
            data="=example3PassedData"
            labels-entity="CountryCodesLabel"
            fallback-label="key"></vdl-action-add-labels>
        <vdl-action-set-var var="example3aData"></vdl-action-set-var>

        <vdl-action-add-labels
            data="=example3PassedData"
            labels-entity="CountryCodesLabel"
            fallback-label="value"></vdl-action-add-labels>
        <vdl-action-set-var var="example3bData"></vdl-action-set-var>
    </vdl-action-group>

Parent Topic VDL Actions

© 2001-2026 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.