Sign in or start a free trial to avail of this feature.
14. Finalizing our Chained Apps
In this lesson, we will create a second app and link it with the workflow in previous lesson to generate our trade area.
Notes about lesson files
- This lesson builds on the workflow from the previous lesson
- This lesson requires two Alteryx workflows
Drop Down tool
- The Drop Down tool creates an interactive filter option based on a list of choices
- The list can either be manually added or the tool can link to an external source
- Trade areas are spatial objects, and can be manipulated or analyzed in spatial object tools, just like centroids
In the previous lesson, we discussed the idea of using a subset of data from one app to drive a second app, a process known as chaining apps. So far, we've designed a straightforward process to filter our master list of hotels by region. This subset of our data is then exported to a temporary file with name and value fields. Our goal in this lesson is to chain two apps together so we can map all competing hotels in a certain proximity of our target hotel. We'll accomplish this by following four key steps. First, we'll create our second app allowing users to select a target hotel and customize the trade area. We'll then set the app to generate a report that displays a map of hotels of the same star status. Third, we'll finalize settings for both apps using the interface designer. Finally, we'll test our chained apps. We'll now begin work on our second app by choosing a target hotel and trade area radius. As with the previous lesson, we're starting with the original hotel master list. We'll need to convert the longitude and latitude information to geospatial data, so we'll create a connect points tool. We then need to create a filter.
For now, we'll tell the tool to filter for hotel 691 as a placeholder.
We'll apply a dropdown to this tool later. Now that we've specified a target hotel, we'll connect a trade area tool to the T output node. This tool will target the centroids in the master list at a radius of five miles.
We're now ready to introduce interface tools to this workflow.
We'll start by connecting a dropdown tool to the filter tool.
In the configuration window for the dropdown tool, we'll specify a target hotel as the text to display.
In this case, our list values will be an external source.
In the properties dropdown, we'll navigate to the temporary file that's the output of the first app. We'll now move on to the action tool. We'll expand simple and then operands, specify operand value hotel 691, and replace the specific string hotel 691.
As you might expect, this will place a placeholder in the filter tool with the user-defined value. Finally, we want to have the option to choose the trade area radius. To that end, we'll connect a numeric up/down tool to the trade area tool. In the configuration window for the numeric up/down tool, we'll enter the text "specify trade area radius." We'll then ensure that the minimum is one, the maximum is 50, the increment is one, and the default is five. We'll then go to the action tool and choose "update trade area radius." We'll now move on to step two and set the app to create a map of hotels of the same star status.
Note that the trade area around the hotel is a spatial object in its own right. Therefore, in order to display the map of competing hotels, all we need to do is look at which hotels intersect with that spacial object. We'll navigate to the spacial tab on the tools palate, bring a spatial match tool onto the canvas, and connect the workflow to the T target input node.
We'll then connect the original data set from before the filter tool to the U-universe input node.
In the configuration window for the spatial match, we want to target trade area spatial objects.
We then want to look for where target contains universe.
As a final touch, we'll restrict our map to hotels of the same star status.
To do this, we need to filter the match set for instances where the stars of the target equal the stars of the universe set.
We'll connect a filter tool and enter the expression "stars=universe_stars." We'll now add our reporting tools. We'll go to the reporting tab on the tools palette, and bring a report map onto the workflow, followed by a render tool.
In the configuration window for the report map, we'll specify a reference space map of carto most recent vintage.
At this point, we're ready to move on to step three and finalize the settings of our apps. We'll navigate to the interface designer to edit the app settings.
We'll go to the properties tab and specify that on success, the app will run the render tool.
We'll save this app and move on to the interface designer for the hotel region app. We'll again navigate to the properties tab and select the option to run another app on success. We'll target the file containing our second app. We'll also deselect the show results box, since we don't wanna see our results until both apps are complete.
At this point, we're ready to move on to the final step and test our linked apps.
We'll click on the magic wand symbol and see that we're presented with an app asking us to choose a region.
Once we pick our region, we'll select continue and see that the app offers us an abbreviated list of hotels together with a radius question.
Upon completion, the app generates a PDF report.
Let's recap what we accomplished in this lesson. First, we created our second app allowing users to select a target hotel and customize the trade area. We then set the app to generate a report that displays a map of hotels of the same star status. Next, we finalized the settings for both apps using the interface designer. Finally, we tested our chained apps and created our own trade area map. Over the past two lessons, we've examined how we can chain apps together using a subset of data from one app to inform questions in a second app. Despite a rather simple example, the level of dynamism this feature offers is still striking.
This concludes our course on apps and macros. As one can see, with practice and a little imagination, analytical apps and macros open up a whole new area for the data analyst.