Using Choose from List
When you want to work with multiple items in your workflows, it’s helpful to learn about the List, Choose from List, and Get Item from List actions.
The List action lets you create an ordered list of data, either by typing in text or inserting variables. When the workflow is run, the entire contents of List get passed into the next action. If you pass a List into a Quick Look action, you can preview each item in the list one-by-one.
For example, List might work as a simple menu of choices for filling out a field (“Dear Sir/Madam”), as a series of album titles you want to choose from to play right away, and much more.
The Choose from List action is helpful for narrowing down a list of items to the ones you want to keep. Choose from List presents you a list of the items that were passed as input, and allows you to select one or more of them to pass to the following action.
For example, you could use the Get Upcoming Events action to grab 15 of your upcoming calendar events, then use Choose from List to choose the specific event you’re looking for.
By default, Choose from List prompts you to select a single item. Turn on “Select Multiple” to allow selecting multiple items when the action runs.
With multiple selection enabled, a “Select All Initially” option is also offered. When turned on, all of the items in the list are selected by default, so that rather than checking the items you want, you can uncheck the items you don’t want.
Choose from List shows rich previews of the items as they’re displayed in the menu. For example, passing iTunes items into Choose from List will display the artist, album artwork, and track length in addition to the title.
If you use the Set Name action on content items and then pass them into Choose from List, the custom name you’ve set will be shown in the menu instead of the default name.
If you use Choose from List on a dictionary item, the menu will show you all of the keys in the dictionary, and for each key you select, the corresponding values will be passed as output.
The output of the Choose from List action is available as a Magic Variable, so that the content you choose can be used again later multiple times throughout your workflow.
It’s also possible to narrow down a list of items automatically using the Get Item from List action. Pass a list into Get Item from List, and you can use the action to retrieve the first or last item in the list, a random item, or a particular item by its index.
You can also retrieve multiple items from the list by providing a range of indexes.
For example, if you were to pass a list of six items into Get Item from List:
- Setting the index to 3 would grab the third item from the list,
- Or setting a range of 3 to 6 would grab the third, fourth, fifth, and sixth items from the list.
Read on to learn more about making choices in your workflows, this time by Using Choose from Menu.