Wednesday 24 May 2023

Control Containers - Part 2 - CReW Container Error Check Macro

In part 1 of this series we looked at the case where we didn't have an input hooked up to our control container in the logging container. This time we are going to look at what we can do with the input anchor connected.

How does the Input Anchor work?

We noted in the last post that without an input anchor the control container works very much like the CReW Runner macro. Well if we connect up the input anchor then the control container works very much like the CReW Conditional Runner macro. That is to say:
  • If the Input Anchor is disconnected
    • All tools inside run as though they were in a regular container (or straight on the canvas)
  • If the Input Anchor is connected
    • If the input anchor receives 0 records – The tools in the Control Container DO NOT run
    • If the input anchor receives >0 records – The tools in the Control Container run AFTER the last input record is received
Or in pictures

Introducing the Container Error Check Macro

With this we now are very close to replacing the CReW Runner macros with Control Containers! All we need is the S and F outputs provided by the runner macros. We replace this with the Container Error Check Macro.

You can download it from:

(To install it copy it into the macros folder where you have the CReW macros installed on your machine. For example C:\CReWMacros\Macros)

You connect it directly after a control container and it has the following behaviour:
  • If the incoming log messages contain an error all records get pushed out of F (Fail) output
  • If incoming log messages have no errors all records get pushed out of S (Success) output
Anyone who has used the Runner macros will find this very familiar.

Conditional Running

Using this macro we can now conditionally run parts of our workflow!

Success case:

Failure case:

This workflow generates a PDF report and then if there are no errors uploads it via an API using the download tool. If on the other hand there are errors, then the file is not uploaded, but an email is sent instead.

Learn More

If you are at Inspire today, please come to my breakout session to learn about this use case and more. 

If you aren't at Inspire, but would like me to present this talk at your local user group them please get in touch and we can set up a date!

Monday 22 May 2023

Control Containers - Part 1 - Logging Container

Well it is Adam here. I'm back posting on my personal Alteryx Blog after a very long time, but Control Containers are such an important new feature to desktop designer (that I have wanted to see in the product for so long) that I just had to write a blog post about them.

What are Control Containers?

In short Control Containers are the biggest innovation in controlling the order of how things run in an Alteryx workflow since we released the CReW runner macros over 8 years ago. Ever wanted to control what order your outputs write in? Or run one section of a workflow before another? Or how about capturing logging and error messages? Control containers can do all of this and I suspect more things that we havn't even thought of yet. I don't say this lightly, but I think Control Containers are going to be a game changer with what you can do in an Alteryx workflow.

They were released last week as part of the 2023.1 release

They are so innovative that myself and Jeff Arnold who worked on the initial design for control containers got a patent granted for the idea

This series of blogs is going to teach you about how Control Containers work through a number of example use cases of what you can do with them.

First up the Logging Container!

When Jeff and I were first throwing around ideas for Control Containers, I actually had proposed that the feature would consist of two tools: A Logging Container and a Control Container. The Logging Container being exactly the same as a Control Container, but with no input anchor. In the end we ended up with a single Container with an optional input. So for now let us pretend the Control Container has no input anchor and just focus on what that output anchor does.

First of all like a regular container a Control Container groups together a set of tools. The first difference we will look at though is that new output anchor.

When a workflow runs, all of the log messages for tools inside the container that usually get written to the messages window, also get output as data from the Control Container's outpur anchor. For anyone familiar with the CReW runner macros this use case is very much like the CReW runner macro, but in a single workflow!

So what is this useful for? Well a number of things, but today we will use it to create an audit trail for our workflow. We enclose the entire workflow in a Control Container and then using regular Alteryx tools we add the current datetime and workflow name and write it to a database.

Now every time this workflow runs we can capture this information and build up a historical record of how things change over time!

Next time we will introduce a new CReW macro tool for making this logging data even more useful.

For anyone at Inspire this week in Las Vegas, please come to my session on Wednesday when we will talk about this use case and a lot more!