Using Find and Filter actions
Sometimes, you’re working with a large amount of content and want to filter down to a subset of that content using certain criteria. For example, you might have a large list of calendar events, but only want those that have an event location set.
Workflow provides two actions that help you in such scenarios: Find and Filter.
Actions with the keywords “Find” and “Filter” both accept the output of another action as input, filter the content, and pass the filtered results as output. If nothing is passed into Find actions, however, they will retrieve content on their own from their respective apps.
Find actions include Find Photos, Find Reminders, Find Calendar Events, Find Music, Find Health Samples, and Find Contacts. Each of these can filter the photos, reminders, events, and other content passed as input, but when no input is passed, they fetch content from their respective apps, similar to “Get” actions.
Filter actions include Filter Event Attendees, Filter Files, Filter Locations, Filter Articles, and Filter Images. Each of these takes content as input, narrows down the content using filters you specify, and passes the matched results as output.
If you are attempting to use two Find actions in a row without causing the second action to filter the output of the first, place a Nothing action in between. That way, “nothing” is passed as input to the second Find action, signalling it to retrieve its own content.
In summary, Filter actions will only filter existing content in the workflow, while Find actions can both find content from the device and filter existing content.
Use the “Add Filter” button to specify criteria the action should use in its search query. After adding a new filter, tap each colored component of the filter to customize it.
For example, if you add a filter to Find Photos, you’ll be able to specify
All Photos. The first option in a filter lets you choose the property of the content to filter against. You can further change how the filter operates with the second and third options, perhaps switching
All Photos to one of your photo albums to just retrieve that album’s photos. Or, you could change
is not if to filter out a particular album, like Panoramas, from your results.
You can add additional filters to the action to further isolate the results you want. Once you add multiple filters, another option appears to specify
All of the following are true or
Any of the following are true, requiring that every filter criteria be matched or at least one of the filters, respectively.
Find and Filter actions also include parameters to “Sort By” and “Limit” your results. Tapping on “Sort By” allows you to choose a property to sort the results by, including
Random to order randomly. Certain properties like “Date Taken” for photos also reveal additional parameters, like choosing the “Order” as
Oldest First or
The last parameter to know about in Find and Filter actions is “Limit”, which allows you to set a cap on the number of content items the action retrieves or filters. Once “Limit” is toggled on, another parameter appears with a +/- toggle for selecting the maximum number of items to get. Additionally, you can tap on the “Get Items” field to set it using a Magic Variable or Ask When Run, allowing you to alter the limit while the workflow is running.
When working with a large amount of content or broad queries in the Find and Filter actions, there may be situations where a workflow may struggle with performance when run from the Today Widget or Apple Watch. In these cases, try using a Continue In App action to switch to the Workflow app, or experiment with more specific filters that limit the number of possible results.
Next, we’ll explore Using the Workflow URL scheme.