Skip to main content

Filter Node

Filter input data based on a condition.

Parameters

expression

The expression is evaluated in Javascript and the result is used to filter the item. If the evaluation result true-ish, the item is kept, otherwise it is filtered out.

The input variable is available in the expression and it refers to the current item in the input data. Input data is organized as an array of items.

Examples

Keep items with price greater than 100

input.price > 100;

Keep items with specific category

input.category === "electronics";

Keep items with price between 50 and 200

input.price >= 50 && input.price <= 200;

Keep items that are in stock

input.stock > 0;

Keep items with specific tags

input.tags && input.tags.includes("sale");

Keep items with non-empty description

input.description && input.description.trim().length > 0;

Keep items with rating above 4 stars

input.rating >= 4;

Keep items from specific brands

["apple", "samsung", "sony"].includes(input.brand.toLowerCase());

Keep items with discount percentage

input.discount && input.discount > 0;

Keep items with specific date range

const itemDate = new Date(input.created_at);
const startDate = new Date("2024-01-01");
const endDate = new Date("2024-12-31");
itemDate >= startDate && itemDate <= endDate;

Keep items with specific text in name

input.name && input.name.toLowerCase().includes("phone");

Keep items with multiple conditions

input.price < 1000 && input.category === "electronics" && input.stock > 0;