community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx Knowledge Base

Definitive answers from Designer experts.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE

Tool Mastery | Block Until Done

Alteryx
Alteryx
Created on

This article is part of the Tool Mastery Series, a compilation of Knowledge Base contributions to introduce diverse working examples for Designer Tools. Here we’ll delve into
uses of the BlockBlockUntilDone.png Until Done Tool on our way to mastering the Alteryx Designer:

 

The Block Until Done Tool is one of those tools that may not be commonly used when starting out in Alteryx. But as users start building out more complex workflows, if errors start appearing out of seemingly nowhere this tool can come quite in handy. The best way to describe this tool is it is like a traffic controller for your workflow. Alteryx normally processes individual records at a time as it is going through the tools. Meaning if you had, let’s say, a total of three tools in your workflow. All three of those tools are simultaneously working through the dataset. As one record finishes being processed by one tool it starts getting processed immediately by another. When you introduce the Block Until Done Tool anywhere in between these three tools, it will wait until all processes upstream are done before sending records out through each of the three outputs - all of which are optional. 

 

Below are some useful ways to utilize this powerful tool:

 

Writing to multiple tabs in the same Excel file

 

Opening up an output excel file automatically

 

Output a file and re-input it within the same workflow

 

When reading and writing is going on from the same data source it is generally good practice to have a Block Until Done before your output to avoid any possible read/write conflicts.

 

The Block Until Done Tool can also be helpful as a way to control the memory used in a workflow. If you are having issues due to low available memory on your machine, strategic placement of the tool before and after memory-intensive tools or macros can make sure that multiple computation heavy processes don’t happen all at once.

 

By now, you should have expert-level proficiency with the Block Until Done Tool! If you can think of a use case we left out, feel free to use the comments section below! Consider yourself a Tool Master already? Let us know at Community@alteryx.com if you’d like your creative tool uses to be featured in the Tool Mastery Series.

 

Stay tuned with our latest posts every Tool Tuesday by following Alteryx on Twitter! If you want to master all the Designer tools, consider subscribing for email notifications.

Comments
Meteoroid

Hey Ozzie,

 

I'd like to really master this. How do I take in an error when someone else is using a file which I'd like to input, block the process until their done with it then return to execute my workflow?

 

Doing the impossible?

 

-JLV

Meteor

Sorry to have to rip on your post a bit, but I have to because the lacking Alteryx explanations issue is pretty pervasive and the most basic of things is often left out of explanations on tools. So here we go.

 

Try placing the tool on your workflow. See the 3 outputs it has? What on earth are those for? You would think that everything downstream of output 1 must finish processing before the downstream of output 2 begins. In my workflow, output 2 runs before output 1. How do I control which parts of my downstream workflow run first? More broadly, I've had a lot of trouble in Alteryx with parts of the workflow not running in the order I need, and I have yet to see a solid solution. I thought this tool would be it.

 

So yes, we would love you to bring us up to an expert level on how this tool works.

Alteryx Partner

Hi,

 

Another use-case that I've been getting a lot of mileage out of the Block Until Done tool with is when I'm writing data to a SQL table and want to create a log file. I use Block Until Done to generate the 'success' status in my report ONLY if the transaction is successful, otherwise the status would be 'failure', usually with some more information about why if possible.

 

I find that using it in this way is a great when looking to diagnose errors from a workflow months down the road, as you'll be able to get informative logs about exactly what went wrong in the SQL statement.

 

Also, @zebing, the Block Until Done tool will use tool IDs to determine which downstream anchor to run first.

 

Cheers!

I'm needing some help on understanding if something is possible.  I have a workflow that I am using, which overwrites a file.  I need to compare the before and after for a different report.  I need to make sure that in this made up pic below, that the "Original File" data is pulled before the other workflow starts to overwrite it as "New Output File", so that I can compare the two to find differences.  I can't seem to have multiple inputs to a "Stop Until Done" tool.  Is this possible?

 

Alteryx pic.PNG

Community Operations Manager
Community Operations Manager

@snelson02,

 

This method will not work for you with the Block Until Done tools. No matter where you put a Block Until done tool all Inputs in Alteryx will run first before any tools whether it's before or after the Block Until Done. What you could look to do is use the Crew Macros which contains a Parallel Block Until Done tool. This tool executes one procedure first then the second. Crew-Macro-Pack. You will have to install these macros.

 

DanM

Meteor

This might seem a "slightly" convoluted solution, but I think that a specially crafted workflow could probably achieve what @snelson02  requires using Block Until Done( I shall call it BUD for convenience)

 

The problem, as has been pointed out, is that there is only a single input to block until done... so you need to get the part of your workflow that you want to run second onto the "downstream" side of the BUD.
Except that you can't... well not quite... but you can achieve this result by doing a bit of jiggery pokery....

 

Take as an example the following...

I have a spreadsheet with two tabs "before" and "after". 
I want a workflow that will read this spreadsheet, and write whatever was in the "before" tab, and place it in the "after" tab. 
I then want this workflow to take an input from a text input and write whatever is in there into the "before" tab of the same Excel worksheet.

As I am trying to write to two tabs, I need a BUD, but I somehow need to join these two "disparate" flows into a single flow...
I do this by the addition of a sample tool, a count tool, a formula tool, and a join tool.

I read in my "Before" tab from the worksheet.
I then add a Block Until Done, whose first action is to write my flow (The Before tab) into the "After" tab.
The second output from BUD is to sample exactly 0% of my current flow and then count the number of rows (which will be zero). The purpose of this is to create a data flow now containing a single known value (a count of zero)
I then add a formula tool which creates a column on this single row workflow. The column name that I create will match the column data type in my "text input" tool but the value will be set to be something different to any value that my text input will contain.
I then join this to the text input. I specify an equality join. e.g. Column1 = MyDataColumn

Because no rows match, the "right" join output will contain all rows from my text input
I can then write these rows to the "before" tab on the same spreadsheet that I read from and wrote to earlier.

So hey presto, after a somewhat contrived set of controls, we can use Block Until Done to control two separate parts of the flow.   ;-)
You may be able to adapt this "pattern" to your own workflow. (although I'm guessing that Crew-Macro-Pack would provide the more robust and clear solution).
It's been an interesting exercise to try to solve this type of problem using the standard tools though.



BUD-workflow2.yxmd.png

 

 

 

 

 

Meteor

@snelson02

 

I've encapsulated a slightly modified version of the above, which does away with my suggested use of the count tool, and uploaded it to the public gallery as Process Sequentially Macro.

 

DemoProcessSequentially.png

If you compare the mock-up workflow above with your earlier picture, I think you will be able to see easily how this macro is used.

 

If you were to open the macro, you'd see it looks like this:

ProcessSequentiallyMacro.png

All it does is allow two data flows (1) and (2) to "pass through" to outputs (1) and (2) respectively. They should remain untouched on the other side. But the output flow to (2) does not occur until (1) completes.