PROCESIO
OverviewPlatform ActionsIntegrations & DemosMarketplaceCustom ActionsDeveloper’s Guide

Filter

Filters a list of data models or JSON objects by one or more field rules written in a JSON configuration.

The Filter action keeps the elements of a list of data models (or JSON objects) whose fields match a set of rules. Each rule checks one field — for example city equals Cluj or email ends with @example.com — and an element is kept only when all rules pass. To filter a simple list of text or numbers, use Simple Filter.

Add the action

In the Process Designer toolbox, open List and pick Filter (or type Filter in the search box). Then click Configure to open the configuration panel.

The Filter action properties with the Configure button

Inputs and outputs

FieldDirectionTypeRequiredWhat to put / what you get
List to filterInputList of data models / JSON objectsYesThe list to filter.
Filter JSON configurationInputText (JSON)YesThe rules, see below.
Filtered listOutputList of data models / JSON objectsYesThe elements that passed every rule, unchanged and in their original order. Use a variable of the same data model as the input.

The JSON configuration

{
  "FieldMatches": [
    { "FieldName": "city", "MatchType": "Contains", "FilterExpression": "cluj", "KeepIfTrue": true },
    { "FieldName": "name", "MatchType": "Contains", "FilterExpression": "maria", "KeepIfTrue": false }
  ],
  "AlternateFields": [
    { "FieldName": "name", "FieldAlternateNames": ["email"] }
  ]
}

FieldMatches

A list of rules (at least one). Every rule must pass for an element to be kept (AND).

KeyRequiredMeaning
FieldNameYesThe field to check, as named in the data model (case-sensitive). Use a dot for a nested field, for example address.city.
MatchTypeYesExact, Contains, Similar, Fuzzy, Soundex, SimilarWordMatch or RegEx. The match types work as in Simple Filter.
FilterExpressionYes in practiceThe value (or regular expression) to compare the field with.
KeepIfTrueRecommendedtrue: the rule passes when the field matches. false: the rule passes when the field does not match. If you leave it out, it counts as false.
FuzzyAlgorithm, FuzzyThresholdOnly for FuzzyAlgorithm name and minimum score from 0 to 1; see Simple Filter for the names.
SoundexDistanceOnly for Soundex0 to 4; 4 (default) means "sounds the same".
SimilarFirstNwords, SimilarLastNwordsOnly for SimilarWordMatchHow many first / last words must be equal.

AlternateFields

Optional. Lets a rule also look at other fields. For the rule on FieldName, the same check is run on each field in FieldAlternateNames:

  • with "KeepIfTrue": true, the rule passes if the main field or any alternate field matches;
  • with "KeepIfTrue": false, the rule passes only if none of them matches.

Alternates work in one direction only: giving name the alternate email does not give email the alternate name.

Example

List to filter:

[
  {"id":1,"name":"Ana Popescu","city":"Cluj","email":"ana@example.com","age":34},
  {"id":2,"name":"Bogdan Ionescu","city":"București","email":"bogdan@example.com","age":19},
  {"id":3,"name":"Ana-Maria Pop","city":"Cluj-Napoca","email":"ana.maria@example.com","age":41},
  {"id":4,"name":"Dan Petrescu","city":"Iasi","email":"dan@test.org","age":27}
]
FieldMatchesKept ids
[{"FieldName":"city","MatchType":"Exact","FilterExpression":"cluj","KeepIfTrue":true}]1
[{"FieldName":"city","MatchType":"Contains","FilterExpression":"Cluj","KeepIfTrue":true}]1, 3
the two rules from the configuration above (city contains cluj AND name does not contain maria)1
[{"FieldName":"age","MatchType":"RegEx","FilterExpression":"^[1-2][0-9]$","KeepIfTrue":true}]2, 4
[{"FieldName":"name","MatchType":"Fuzzy","FilterExpression":"Dan Petrscu","FuzzyAlgorithm":"JaroWinkler","FuzzyThreshold":0.9,"KeepIfTrue":true}]4
[{"FieldName":"city","MatchType":"Exact","FilterExpression":"Bucuresti","KeepIfTrue":true}]2
[{"FieldName":"name","MatchType":"Contains","FilterExpression":"test","KeepIfTrue":true}] with AlternateFields [{"FieldName":"name","FieldAlternateNames":["email"]}]4 (found in the email)

A nested field also works: with the list [{"id":1,"address":{"city":"Cluj"}},{"id":2,"address":{"city":"Iasi"}}] and "FieldName":"address.city", "FilterExpression":"cluj", Exact, only id 1 is kept.

Good to know

  • Field values are compared in lower case, with double spaces reduced and accents removed. Write the FilterExpression without accents: București finds nothing, Bucuresti finds the record.

The FilterExpression is converted to lower case before it is used. For RegEx rules this changes upper-case escape codes: \D (non-digit) becomes \d (digit), and the same for \W, \S and \B. For example "^\\D+$" keeps nothing instead of the names without digits. Use character classes instead, such as "^[^0-9]+$". Matching is always case-insensitive.

  • Backslashes in a regular expression must be doubled in the JSON: "@example\\.com$".
  • Numbers and true/false values are compared as text (age 19 is the text 19).
  • Each element must have every field named in FieldName (and in its alternates). If one element misses a field, the whole step fails with The data does not contain the field '…'!
  • An unknown MatchType does not fail the step; that rule never matches.
  • The step also fails when the list is empty (The input list does not have any element!), when FieldMatches is missing or empty, when the JSON is invalid, or when the list holds simple values instead of objects.

On this page