Remove a set of matches from a list
Function: Remove a set of matches from a list
This function helps you clean up your lists by automatically finding and removing items that meet specific criteria you define. Instead of manually going through a list, you can set up rules (filters) to identify the items you want to get rid of, and the platform will remove them for you. This is useful for maintaining data quality, removing outdated entries, or streamlining information.
Input
- List (Type: Array of Variables) The list of items you want to modify. This could be a list of customers, products, tasks, or any other collection of data in your application.
- Filters (Type: Array of Objects)
A set of rules that determine which items should be removed from the list. Each filter consists of three parts:
- Attribute: Choose a specific field or property within the items of your list (e.g., "Product Name", "Order Status", "Creation Date").
- Operator: Select how the attribute should be compared. Examples include:
Equal: The attribute must be exactly the same as your specified value.Greater than: The attribute's value must be larger than your specified value (for numbers or dates).Contains: The attribute's text must include your specified text.Not equal: The attribute's value must be different from your specified value.- And many more options for various comparisons.
- Value: The specific data you want to compare against the attribute (e.g., "Expired", 100, "Pending"). This value's type will adapt to the chosen attribute.
Output
This function does not produce a new list as an output. Instead, it directly modifies the original List you provided, removing all items that match your specified filters.
Execution Flow
Real-Life Examples
Example 1: Removing Inactive Users
Imagine you have a list of all users in your system, and you want to remove any users who have been marked as "Inactive" for more than a year.
- Inputs:
- List:
All Users(a list of user records, each with properties likeStatusandLastActivityDate). - Filters:
- Attribute:
Status, Operator:Equal, Value:"Inactive" - Attribute:
LastActivityDate, Operator:Less than, Value:[Current Date - 365 days]
- Attribute:
- List:
- Result: The
All Userslist will be updated, and all users who are "Inactive" AND whoseLastActivityDateis older than one year ago will be permanently removed from the list.
Example 2: Clearing Out Low-Stock Products
You manage an online store and want to remove products from your "On Sale" list if their stock quantity drops below a certain threshold, to avoid selling out.
- Inputs:
- List:
On Sale Products(a list of product records, each with properties likeProductName,Price,StockQuantity). - Filters:
- Attribute:
StockQuantity, Operator:Less than or equal, Value:5
- Attribute:
- List:
- Result: The
On Sale Productslist will be updated, and any product with aStockQuantityof 5 or less will be removed from the "On Sale" promotions.
Example 3: Deleting Completed Tasks from a Project List
You have a project management application and want to clean up a list of tasks by removing all tasks that have been marked as "Completed" and are not marked as "High Priority".
- Inputs:
- List:
Project Tasks(a list of task records, each with properties likeTaskName,Status,Priority). - Filters:
- Attribute:
Status, Operator:Equal, Value:"Completed" - Attribute:
Priority, Operator:Not equal, Value:"High"
- Attribute:
- List:
- Result: The
Project Taskslist will be updated, and all tasks that are "Completed" but are NOT "High Priority" will be removed, leaving only active or high-priority completed tasks.