I haven’t written very much about Alteryx, although I do now use it EVERY SINGLE DAY. I’ve been hesitant because the Alt Nation Community is fabulous. I struggle with the utility of publishing my own content when it’s not likely to register in search results. However, I frequently write just for myself. And, it pays off. This week I referred back to a Spotfire post I wrote over 2 years ago. Therefore, I’m writing about a problem I ran into this week with scheduling an Alteryx workflow to run on the last business day of the month. If this is a problem you’ve run into, read on.
Just in case you aren’t familiar with the Alteryx scheduler, here are 2 screenshots. The first shows the recurring options. Obviously, it doesn’t contain any options here that would help me schedule the workflow to run on the last business day of the month. Granted, this isn’t an easy task. Think of how complex this could get with holidays and time zones.
The second screenshot below shows custom options. Initially, I thought I would use this to create 12 custom schedules (one for each month). I do believe that would have worked, but….
One of my co-workers, Chris Fink, showed me a much more interesting solution using the Conditional Runner tool from the CrewMacro by Chaos Reigns Within. This tool allows something to happen based on a condition. The condition in my case is a filter.
WARNING: Apparently, there are issues with this macro in the latest version of Alteryx (2019.3). Fortunately, I’m not on that version yet.
If you aren’t familiar with macro installation, you can find that information here.
The Moving Parts
Here is the finished project that I’ll call my Trigger Workflow.
It consists of the following tools:
- Date Time Now tool (In/Out Tool)
- Filter tool
- Conditional Runner tool (CReW macro tool)
- Union tool (optional)
- Filter tool (optional)
- Browse tool (optional)
- Email tool (optional)
Date Time Now Tool
I configured the Date Time Now tool to only show the year, month, and day.
It produces an output that looks like this.
That flows to the Filter tool where I have written an expression based on the dates I want the workflow to run. Now, I have scheduled this workflow to run once a day. If it runs and the Date Time Now is NOT equal to one of the dates shown below, nothing happens. If it runs and the Date Time Now does equal one of the dates shown below, it triggers the Conditional Runner tool.
Conditional Runner Tool
The Conditional Runner config looks like the screenshot below. I simply connect it to my workflow, which is saved on a shared drive.
The Conditional Runner will only navigate to workflows saved on a drive. It will NOT allow you to navigate to a workflow in the Gallery. So far, that is the only limitation I’ve run into with this solution that I didn’t like. It doesn’t matter because I will schedule this Trigger Workflow, not my primary workflow. Thus, my primary workflow can be saved on a drive, and the Trigger Workflow is saved in the Gallery.
The Conditional Runner produces this output from either the Success or Failure branches. I union them together so that I know what’s happening all the time. Then, I apply a filter to get rid of the nulls. Lastly, I email the Conditional Runner output to myself.
Just to be clear about my steps and all the moving parts, here’s a summary.
- Create primary workflow doing the work.
- Save it to a drive.
- Create Trigger Workflow with the Conditional Runner tool.
- Save it to the Gallery.
- Schedule the secondary or trigger workflow in the Gallery.
Just before wrapping up, I will say that I was surprised I didn’t have to install the macro on the server. It might have already been there installed by someone else, but my workflow ran in the Gallery without any action on my part on the server.
In conclusion, I think I’ll keep writing this stuff up. I love the Alteryx community, but I can see a lot of good reasons to do this here, like longer write-ups and the ability to draft and refine. Hopefully, you make use of this solution for scheduling an Alteryx workflow to run on the last business day of the month.
Content created with Alteryx 2019.2.7
If You Enjoyed This
Check out the post I wrote after the 2019 Gartner Analytics Conference. The Alteryx presentation heavily influenced my thoughts.