I hit a wall in my previous post when trying to dynamically update a drop down interface tool with the field names of a given input dataset. The issue was that if the field names in the incoming dataset were different to the field names of the dataset that I built my macro/app with, then the potential selections in my drop down menu wouldn’t update accordingly. It took me a while to get my head around why this was happening, but I soon realised that it was entirely due to the order of operations within the macro/app. From the users perspective, the user has to choose what field names to run the macro/app with before the macro/app is actually run, and before any new data makes its way into the macro/app. The drop down tool could not update because the macro/app hadn’t been run yet.

One solution, at least for analytic apps in Alteryx, is to use chained apps. Chaining apps allows you to link apps together so that one app is run immediately after the other. Here’s how I used chained apps to dynamically update my drop down interface tools according to the field names of any newly inputted dataset.

Originally, I was working on an app that calculated the moving average over a range of values. The beginning of the workflow looked something like this:

In container #1 I was exporting the field names of my input data to an external file, while the drop down tools at #2 were reading the field names back in from this file. I soon found out that because of the order of operations, the drop down tools never updated if the field names of my dataset changed.

The solution was to separate this workflow into two apps and chain them together. The first app exported the field names of the input file, like so:

The second app, which contained the data processing workflow, would then read this external file into the drop down tools using the “External Source” option from the List Values argument.

By doing this, the new field names were accessible to the second app before it had run.

To link the apps, go to the interface designer for the input tool of the first app, and navigate to the properties pane. Here, there is an option “On Success – Run Another Analytic App”, where you can browse to the location of your second app, which will be triggered immediately after the first. Another box you might consider unselecting is the “On Success – Show Results To User” option, because we’re not really interested in viewing the output files from the first app before our second app is run.

That’s about it! You now have dynamically updated drop down interface tools in your Alteryx apps.