Ask AI
Skip to main content

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 like Status and LastActivityDate).
    • Filters:
      1. Attribute: Status, Operator: Equal, Value: "Inactive"
      2. Attribute: LastActivityDate, Operator: Less than, Value: [Current Date - 365 days]
  • Result: The All Users list will be updated, and all users who are "Inactive" AND whose LastActivityDate is 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 like ProductName, Price, StockQuantity).
    • Filters:
      1. Attribute: StockQuantity, Operator: Less than or equal, Value: 5
  • Result: The On Sale Products list will be updated, and any product with a StockQuantity of 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 like TaskName, Status, Priority).
    • Filters:
      1. Attribute: Status, Operator: Equal, Value: "Completed"
      2. Attribute: Priority, Operator: Not equal, Value: "High"
  • Result: The Project Tasks list 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.