Sign in or start a free trial to avail of this feature.
13. Developing a Chained App
Learn how to use the choices made interacting with one analytical app to drive the logic of a subsequent analytical app. In this lesson we will create the first of a pair of linked apps that generate a hotel trade area.
- Chaining Apps is the process of using the outputs of one app to drive the available choices in a second app
- In this example, we’ll use one app to limit a list of hotels by region, and then use the second app to develop a trade area of competitors in the same star class
Through this course we've introduced the concept of basic analytical apps as well as different types of macros. Over the next few lessons we'll shift our focus back to the analytical apps by looking at chaining apps. In our previous analytical app example we updated the choices in a list box dynamically by making reference to an earlier part of the workflow and making use of the summarize and cross tab tools. We can further elevate this level of interaction by making the choices from one app to drive the logic of a second app. This is known as chaining and is a very powerful feature of apps in Alteryx. Let's look at an example. Let's say we own a chain of five star hotels and we want to map all our competitors within a certain proximity. If we run the current workflow we can see that there just over 1,700 hotels to choose from. Choosing a target hotel from this list may be a bit cumbersome so we'll first filter the list by region. We'll then write the sub list of hotels from that specified region to a temporary file which we can subsequently feed through to a second app. The second app will use that abbreviated list to deliver the user's requirements. By linking these two applications we're creating a chain and creating a way to target a specific segment of the competition. This process is a bit complex so we'll run through everything over the next two lessons. In this lesson we'll create an app that filters our hotels by region and sends that list to a temporary file. We'll accomplish this goal by following four key steps. First, we'll filter hotels by region.
We'll then reformat the resulting list to prepare it for use by our second app. Third, we'll create the output directory for the temporary file.
Finally, we'll add interface tools to the workflow to complete the first app. We'll start with step one, filtering our list of hotels to specify a region.
We'll bring a filter tool onto the canvas and connect it to the hotel dataset.
We'll then use the tool to set the region equal to London.
The value here isn't important as we'll connect an interface tool when we develop the app. We're now ready to move onto step two and reformat the resulting list of hotels. Our goal is to devise an abbreviated list of hotels for this region that we can use in the second app.
The second app requires the data to be delivered in a specific format with name and value fields.
Before we reformat our data, let's sort it based on hotel number so individual hotels are easier to find. To that end we'll connect a summarize tool to the T output node of the filter tool. In the configuration window we'll group by the field hotel which contains a list of numbered hotels. We want to sort this list in numerical order so we'll add a text to column tool to separate the hotel and number information. To that end we'll choose a space as our delimiter and split the data into two columns.
We'll run the workflow and see if the hotel numbers are now split into their own column.
Next, we'll connect a select tool, convert the hotel numbers to an integer, rename the field to Record ID and deselect the hotel one column as it doesn't contain any useful information. We'll now connect a sort tool and set the Record ID field to list in ascending order. We must now create the name and value fields so that our temporary file can be interpreted by the second app. We'll connect a formula tool, and first create the name column.
In the canvas we'll simply enter the hotel field. We'll create a new canvas, label it value and again, enter the hotel field into the canvas. At this point we'll move onto step three and create a temporary file for our data output. To accomplish this we'll navigate to the in/out tab on the tools palette and connect an output data tool to write our temporary file. We'll set the directory for the file, and ensure the file format is Alteryx Database. We're now ready to move on to the last step and finalize the app by adding flexibility to the region filter. We'll run the workflow, and create space for our interface tools. We'll navigate to the Interface tab and connect a dropdown tool to the filter tool.
In the configuration window for the dropdown tool we'll specify the question which region? We'll then list a manual set of values corresponding to the various regions in our dataset. We'll click on the action tool, expand simple, expand operand, and select operand value equals London. We'll then specify to replace a specific string, London.
This tells the filter tool to replace the London value with the region specified by the user. We'll end the lesson by running the app so that the temporary file is written to the directory that we previously specified. Let's stop here and recap what we've accomplished. First, we filtered hotels by region.
We then reformatted the resulting list to prepare it for use by our second app. Third, we created the output directory for the temporary file. Finally, we finished off the app by connecting a dropdown tool to the filter tool. In the next lesson we'll create our second app, link the apps together, and then test the configuration.