Find a subset of a list
Function: Find a subset of a list
This action helps you sift through a collection of items (a list) and pick out only those that meet specific criteria you define. It's like using a search filter to narrow down a large set of data, allowing you to extract precisely the information you need from a broader collection.
Input
- List: This is the main collection of items you want to search through. It could be a list of customers, products, tasks, or any other data where each item has different pieces of information (attributes).
- Filters: These are the rules you set to decide which items to keep. You can add one or more filters, and each filter specifies:
- Attribute: A specific piece of information within each item in your list (e.g., "Customer Name", "Product Price", "Task Status").
- Operator: How you want to compare the attribute's value (e.g., "Equal", "Greater than", "Contains"). You can choose from options like:
- Equal
- Greater than
- Greater than or equal
- In (checks if the attribute's value is one of several specified values)
- Less than
- Less than or equal
- Not equal
- Not in (checks if the attribute's value is NOT one of several specified values)
- Contains (checks if the attribute's value includes a specific text)
- Contains (ignore case) (same as 'Contains' but ignores capitalization)
- Starts with
- Ends with
- Value: The specific data you want to compare against (e.g., "John Doe", 50, "Pending"). This value will be checked against the chosen attribute using the selected operator.
Output
- Result: A new list containing only the items from your original list that successfully matched all the filters you set. This new, filtered list will be stored in a variable you name, ready for further use in your application.
Execution Flow
Real-Life Examples
Example 1: Finding active customers
Imagine you have a list of all your customers and you want to quickly see who is currently active.
- Inputs:
- List:
Customers(a list of customer records, each with attributes like "Name", "Status", "Last Purchase Date"). - Filters:
- Filter 1:
- Attribute:
Status - Operator:
Equal - Value:
Active
- Attribute:
- Filter 1:
- List:
- Result: A new list called
ActiveCustomerscontaining only the customer records where the "Status" is "Active".
Example 2: Identifying high-priority tasks due soon
You manage a project and need to find all tasks that are both high priority and due within the next week.
- Inputs:
- List:
ProjectTasks(a list of tasks, each with "Priority", "Due Date", "Assigned To"). - Filters:
- Filter 1:
- Attribute:
Priority - Operator:
Equal - Value:
High
- Attribute:
- Filter 2:
- Attribute:
Due Date - Operator:
Less than or equal - Value:
[Today's Date + 7 days](a dynamic value representing one week from now)
- Attribute:
- Filter 1:
- List:
- Result: A new list called
UrgentTaskscontaining tasks that are both "High" priority and due within the next 7 days.
Example 3: Filtering products by category and price range
You want to display all electronic products that are priced between $100 and $500 on your e-commerce site.
- Inputs:
- List:
AllProducts(a list of products, each with "Category", "Price", "In Stock"). - Filters:
- Filter 1:
- Attribute:
Category - Operator:
Equal - Value:
Electronics
- Attribute:
- Filter 2:
- Attribute:
Price - Operator:
Greater than - Value:
100
- Attribute:
- Filter 3:
- Attribute:
Price - Operator:
Less than or equal - Value:
500
- Attribute:
- Filter 1:
- List:
- Result: A new list called
MidRangeElectronicscontaining products that are in the "Electronics" category and priced between $100 and $500 (inclusive of $500).