On the second week of learning Alteryx, we learnt how to use API to extract data from websites. When creating Analytical APP from Alteryx, we often use the Drop Down tool to allow the user to select from a list to filter and view the result. To input the list, it is common to manually type in the data. But what if the list changes over time? What if we are adding a new dimension into the list later this month? We would need the input to be dynamic so that we do not have to manually update it every single time.

I will provide an example with a step by step walk through to demonstrate how we can do this. For this example, we will be using API to extract data from The Meal Database. It is a website contains 294 meal options from a variety of Areas (e.g. Chinese, Turkish, Italian) and Categories (e.g. beef, lamb, chicken), with other relevant information about ingredients, cook instructions etc. Always remember, the first thing to do is to check out their API documentation, authentication, rate limit and pagination. After that, we are good to go. Now, the user input and output of the Analytic APP I made looks like this:

For the category, the list includes: Beef, Chicken, Dessert, Lamb, Miscellaneous, Pasta, Pork, Seafood, Side, Starter, Vegan, Vegetarian, Breakfast, Goat and we can obtain this list through API (www.themealdb.com/api/json/v1/1/categories.php). With the JSON code we obtain through API, we can simply parse it using Regex or JSON Parse tool. Below are my workflow and the result:

Now, we have the dynamic list of categories, let’s take a look at the Drop Down tool. It has many options for the list values. Since we want it to be dynamic, we need to choose “Fields from Connected Tool“.

Note that to input the fields from connected tool, we need to reformat the list values to be column headers using Cross Tab and put something in the value cells to be placeholders.

Finally, we can connect this output to the input anchor of the Drop Down tool. This way, we can use the API output (in this case, the list of categories) as a dynamic input for another API application. After that, it will be another similar process of extracting data using API and parse it to obtain the data we wanted for further analysis. And this dynamic input process can be replicated multiple times as needed.

Hope this will help you on your journey in learning Alteryx.




The Data School
Author: The Data School