Filter lists with Python code
Recipe ToolsDeveloper ToolMarketing
What it does
When someone calls a function with a list parameter, this automation creates a fruits list and executes Python code to filter items based on a condition. The filtered results are logged to the job report so someone can see what passed the filter.
Who it's for
Engineering teams who need to process and filter lists using Python code in their workflows.
How teams use this
Filter items by name pattern
Call the function with a list of fruits and filter for names containing a specific letter or substring. The Python code checks each item and returns only matches to the job report.
Filter by numeric property
Extend the setup to include a numeric property on each fruit, such as quantity or price, and filter the list to return only items above or below a threshold value.
Reuse the filter in other workflows
Call this same function from other workflows to filter different lists with the same Python logic, reducing duplication across automations and saving time on setup.
How it works
- Call the function with a list. Invoke the function with a list passed as a parameter in real time so the automation receives the data to process.
- Filter the list with Python. Execute Python code that filters the fruits list based on a specific condition, such as items matching a criteria or threshold.
- Log the filtered results. Print the filtered output data to the job report so someone can confirm which items passed the filter and review the outcome.