Initializing help system before first use

vdl-action-filter

Filter data by key(s), by value(s) or by a custom function.

since 5.0

Required parent element

Must be contained within one of the following elements:

Example

<!-- filtering an array of objects, typical output of vdl-action-get-entity-data -->
<vdl-var name="data" value=""></vdl-var>
<vdl-action-group name="getData">
  <vdl-action-get-entity-data entity="myEntity"></vdl-action-get-entity-data>
  <vdl-action-set-var var="data"></vdl-action-set-var>
  <!-- array of objects, typical output of vdl-action-get-entity-data -->
  <!-- vars.data = [ 
    {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>

<!-- filter by key -->
<vdl-action-group name="filterDataByKey">
  <vdl-action-filter data="=vars.data" set-position="1" keys="=['3', '4', '5']" reject="false"></vdl-action-filter>
  <!-- will return: [{"key":["revenue","3"],"value":300},{"key":["cost","4"],"value":400},{"key":["cost","5"],"value":500}] -->
</vdl-action-group>

<!-- reject by key -->
<vdl-action-group name="rejectDataByKey">
  <vdl-action-filter data="=vars.data" set-position="1" keys="=['3', '4', '5']" reject="true"></vdl-action-filter>
  <!-- will return: [{"key":["revenue","1"],"value":100},{"key":["revenue","2"],"value":200},{"key":["cost","6"],"value":600}] -->
</vdl-action-group>

<!-- filter values >= min -->
<vdl-action-group name="filterDataByMin">
  <vdl-action-filter data="=vars.data" min="400" reject="false"></vdl-action-filter>
  <!-- will return: [{"key":["cost","4"],"value":400},{"key":["cost","5"],"value":500},{"key":["cost","6"],"value":600}] -->
</vdl-action-group>

<!-- filter values <= max -->
<vdl-action-group name="filterDataByMax">
  <vdl-action-filter data="=vars.data" max="400" reject="false"></vdl-action-filter>
  <!-- will return: [{"key":["revenue","1"],"value":100},{"key":["revenue","2"],"value":200},{"key":["revenue","3"],"value":300},{"key":["cost","4"],"value":400}] -->
</vdl-action-group>

<!-- filter values >= min && <= max-->
<vdl-action-group name="filterDataByRange">
  <vdl-action-filter data="=vars.data" min="200" max="400" reject="false"></vdl-action-filter>
  <!-- will return: [{"key":["revenue","2"],"value":200},{"key":["revenue","3"],"value":300},{"key":["cost","4"],"value":400}] -->
</vdl-action-group>

<!-- filter values < min && > max -->
<vdl-action-group name="rejectDataByRange">
  <vdl-action-filter data="=vars.data" min="200" max="400" reject="true"></vdl-action-filter>
  <!-- will return: [{"key":["revenue","1"],"value":100},{"key":["cost","5"],"value":500},{"key":["cost","6"],"value":600}] -->
</vdl-action-group>

<!-- filtering grouped data, typical output of vdl-action-get-entity-data & vdl-action-group-by -->
<vdl-var name="data" value=""></vdl-var>
<vdl-action-group name="getData">
  <vdl-action-get-entity-data entity="myEntity"></vdl-action-get-entity-data>
  <vdl-action-group-by data="=data"></vdl-action-group-by>
  <vdl-action-set-var var="data"></vdl-action-set-var>
  <!-- array of objects, typical output of vdl-action-get-entity-data -->
  <!-- vars.data = [ 
       { 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>

<!-- when filtering grouped data, filtering done on the contents of the values property-->
<vdl-action-group name="filterGroupDataByRange">
  <vdl-action-filter data="=vars.data" min="300" max="400" reject="false"></vdl-action-filter>
  <!-- will return: [{"key":"revenue","values":[{"key":["revenue","3"],"value":300}]},{"key":"cost","values":[{"key":["cost","4"],"value":400}]}] -->
</vdl-action-group>

<!-- primitive array can be filtered by value -->
<vdl-action-group name="filterArrayMin">
  <vdl-action-filter data="=[100, 200, 300, 400, 500]" min="200" reject="false"></vdl-action-filter>
  <!-- will return: [200,300,400,500] -->
</vdl-action-group>

Attributes

custom-filter Custom filter to perform on the data. Will be called with data, setPosition, keys, min, max and reject parameters. since 5.0 accepts expression
data The data which is to be filtered. If the data attribute is not set then the current value from the VDL action group will be used. since 5.0 accepts expression
keys Singular or array of keys to filter by, used in conjunction with set-position. min and max attributes will be ignored if key attribute is set. since 5.0 accepts expression
max Include values less than or equal to this value. Ignored if keys attribute is set. since 5.0 accepts expression
min Include values greater than or equal to this value. Ignored if keys attribute is set. since 5.0 accepts expression
reject Set to true to negate the filter and return values less than min and greater than max. since 5.0 accepts expression
set-position When filtering by key, the position of the key you wish to filter data by. For example: key[x,y] to filter by y set-position="1" since 5.0 accepts expression

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