filterarray - Filter an Array by an Operator

Filters an array by an given comparison operator.
This function, called "filterarray", filters an array of data based on a given comparison operator and criteria. The input data is an array of lines with mixed values, where each line represents a row of data. The user specifies the name of the field in the data to look for criteria, and the comparison operator to use (default is "=="). The criteria can be either a number or a string. Additionally, the user can choose to ignore case sensitivity for the operation.

Here are some examples of using this function:

Example 1: Filter by an exact value match In this example, the user wants to filter the data by looking for rows where the value in the "Column3" field is exactly equal to 3. The user sets the operator to "==" and the criteria to 3. The function returns one row of data that matches this criteria, which is the row with "US" in the "Column1" field.

Example 2: Filter by a range of values In this example, the user wants to filter the data by looking for rows where the value in the "Column3" field is greater than or equal to 2. The user sets the operator to ">=" and the criteria to 2. The function returns two rows of data that match this criteria, which are the rows with "Germany" and "US" in the "Column1" field.

Example 3: Filter by a case-insensitive value match In this example, the user wants to filter the data by looking for rows where the value in the "Column2" field is equal to "apple" (note the lowercase "a"). The user sets the operator to "==" and the criteria to "apple". However, the user also sets the ignoreCase parameter to true, so that the function will match rows where the value in the "Column2" field is "apple" with either a lowercase or uppercase "a". The function returns two rows of data that match this criteria, which are the rows with "Germany" and "US" in the "Column1" field.

data
Type
array
Required
required
Array of lines with mixed values.
Minimum: 1
Example:
[
  {
    "Column1": "Germany",
    "Column2": "Apple",
    "Column3": 1,
    "Column4": true
  },
  {
    "Column1": "Germany",
    "Column2": "apple",
    "Column3": 2,
    "Column4": true
  },
  {
    "Column1": "US",
    "Column2": "Apple",
    "Column3": 3,
    "Column4": true
  }
]
queryField
Type
string
Required
required
Name of the field in data to look for critera. Case sensitive
Example:
Column3
operator
Type
string
Comparison operator. Defaults to eq
Possible values are: eq, gt, ge, lt, le, ne
Example:
eq
criteria
Type
string
Required
required
Criteria to look for must be number or string
Example:
3
ignoreCase
Type
boolean
Sets case sensitivity for operation.

Available on

Postman
Make
Zapier
N8N
Airtable
SeaTable
Bubble
Power Automate
Workato
SAP Build