One of the things I love about Alteryx is how fast it pushes data through a workflow. However, sometimes, we need to run one part of a workflow before another. In other words, we want to control the order of operations in Alteryx. I knew the application could do this, but to incorporate it into my workflow, I had to learn a few new tools. Read on to learn which tools allow you to control the order of operations in a workflow.
My Use Case
I have an Alteryx workflow that pulls production data every month for a set of wells. The workflow writes the data to an Excel file named “Current Month”. It also writes the same data to another Excel file called “Previous Month”. When the process runs the next month, the workflow will pull a fresh Current Month and compare the list of wells to the Previous Month wells to make sure no wells have dropped out (stuff happens). Now, my workflow runs pretty quickly, and I need to make sure that the Previous Month Excel file isn’t overwritten before the comparison happens.
The two screenshots below show the parts of the workflow that need to run first and second. Note two things. First, the container with the Excel output tools is closed. I had it closed while developing. Second, I don’t have a copy of my original workflow anymore. This shows the workflow after I started using the Parallel Block Until Done tool. I just want you to see the two parts of the workflow that need to run one after the other.
The Right Tool for the Job
Now, I’m in that phase where I am learning a ton of new tools. I was vaguely familiar with the Block Until Done tool from the Developer palette. I thought I could use it for this task, but in trying to understand it’s configuration, I ran across a community post that made me realize this wasn’t the right tool for the job.
The Alteryx Community post described Block Until Done like this:
The Labelled Block Until Done essentially is a “Block Until Done” tool. It takes a stream of data and doesn’t allow any data to exit the tool until all incoming data has been read. Once it reads 100% of the data, it sends all of the data through Output Anchor #1. When all of the data is sent through that anchor, it sends the same data through Output Anchor #2.MarqueeCrew
Based on that description, Block Until Done isn’t the right tool because it only handles one stream of data. Instead, the post suggested using the CReW Macro tool Parallel Block Until Done.
It describes the tool usage like this:
The Parallel Block Until Done is a different beast. It can control two (2) streams of data. It will similarly read all of Input Anchor #1 and then output the data but will not begin the output of Anchor #2 until all of the output from Anchor #1 has been passed through the macro.MarqueeCrew
This is exactly what I want! Now, you might have noticed that I circled two CReW Macro tools above. That is because I needed to make sure that one stream was running before the other. I tried to do this with Formula tools using the DateTimNow function as shown below. But, the tools showed the same DateTime.
I put this out to the Alteryx Community and joshuaburkhow responded with a solution. He suggested using the CReW Macro Wait A Second tool to add a pause in the workflow, which would allow my DateTimeNow tools to shown different date times. (You’ll notice I reorganized a bit. This is the final version).
Here, you can see that data exited the 1st anchor of the Parallel Block Until Done tool at 9:57:52.
And here, it exited the second anchor at 9:57:56. So, I know that my previous month’s data is used in comparison with the current month before it is overwritten at the end of the workflow.
If you aren’t familiar with CReW macros, check out this Alteryx Community post. They are a separate download and installation. If you are going to run them in scheduled workflows, they also need to be installed on your Alteryx server.
By using the CReW Macro Parallel Block Until Done and Wait a Second Tools, I was able to control the order of operations in Alteryx. I was able to specify when different parts of my workflow ran. Lastly, I’ve only recently started blogging about Alteryx, but check out some of my other posts.