Showing posts with label Unique. Show all posts
Showing posts with label Unique. Show all posts

Wednesday, 17 September 2014

Blog Macro Pack - 2014 Q3 Release

Can you believe it has been three months since Inspire 2014 already?  Which means it is time for the next release of the Blog Macro pack!

It is available for download now at


For installation and support information please read the original post from June http://www.chaosreignswithin.com/2014/06/blog-macro-pack.html

I had thought that after the first collection of macros I released at Inspire that I would be adding perhaps two or three macros per quarter, but this release sees another nine new macros!  So let me give you a brief introduction to the newcomers:

The Runner Macros


These are probably the most exciting of the new macros in that they are a complete new category of tools.  The premise behind them is that you might have a number of Alteryx modules that you want to run in sequence.  These tools allow you to write an Alteryx module which runs other Alteryx modules.

They come in two styles.  First we have the Runner and Conditional Runner:

The Runner macro has a single configuration value which is the path to the module you want it to run.  It runs the module and if the run completes without errors, outputs the log to the Success output.  If there are errors then it outputs the log to the Failure output.
The Conditional Runner works in much the same manner, except that it has an input.  The conditional runner will run its module exactly one time if it receives any input data.  If it received no data it will not run its module.





This means using the two in combination you can run a series of modules where the next module in the chain only runs on success of the previous.  Additionally you could use email tools to notify you in case of a failure:


The second style is the List Runner macro.  This one will take a list of Alteryx modules as a data input and run them one after the other.  It also has a check box to enable the process to stop if a module errors. It outputs all of the logs to a single output with a field indicating success or failure.
Useful if you have a directory of modules and you want to run all of them:

.
The last tool in this new category is the Log Parser.  The above three tools all output the Alteryx log in a single cell.  The log parser tool takes this cell and parses it into an Alteryx data table:


These four new tools are all brand new and somewhat experimental, so if you run into any issues with them or have any ideas for improvements then please let me know.  I am sure there will be a few more versions of them yet!  Feel free to add comments here or join the conversation we have going over on the Alteryx Community site:


Community Inspired Macros


Which leads me into the next two macros which were directly inspired by ideas posted on the community site.

The Field Sort tool will sort the fields on the data stream alphabetically as requested here http://community.alteryx.com/Common-Use-Cases/Sort-Field-Names-Tool
The Dynamic Metadata tool will take metadata from another data-stream as requested here http://community.alteryx.com/Developer/Dynamic-Rename-Additional-Functions






Inspiring Ingenuity


Alteryx's CTO Ned Harding's blog http://inspiringingenuity.net/ saw two new macros this quarter which again I have adopted into the macro pack.

The Wildcard Input macro opens multiple files which have differing data schemas using the wildcard syntax.  Check out the full details here http://inspiringingenuity.net/2014/06/27/alteryx-wildcard-inputs/







The Skip Last N records is another community inspired tool and will skip the last N records in a data-stream much like the sample tool will skip the first N.  Again check out the full story here http://inspiringingenuity.net/2014/07/15/alteryx-skip-last-n-records/




Only Unique


Which brings me to the last of our nine new macros the Only Unique macro.  I blogged about this back in August http://www.chaosreignswithin.com/2014/08/only-unique-macro.html.  It works very much like the unique tool except that if there are duplicates then ALL of the duplicate records come out of the duplicate output (rather than one of them coming out of the unique output).


That wraps up the new tools for this release.  As always it is great to hear people's feedback so any thoughts/comments/improvements just let me know in the comments below.

Friday, 1 August 2014

Only Unique Macro

While adding "All" and "None" buttons to the unique tool a couple of weeks ago, I was reminded of a macro which I have found useful on occasion but not yet shared on this blog.  The Only Unique Macro:

pictured here with the standard Unique Tool.  

The Unique Tool is great for ensuring that a set of fields is unique, however when you have a set of fields you expected to be unique but aren't, working out why is a little tricky.  

The reason for this is say you have five identical duplicate records (on the selected fields) and you want to look at all of those records together (perhaps to see what is in the other fields), one of the five records is in the unique output stream and the other four are in the duplicates output stream.  If you have a million other records in the unique output stream, finding that one can be hard.

Enter the "Only Unique" macro.  The working of which is as follows:
  • If there is exactly one record with a combination of the selected field values it comes out of the unique stream. So the unique output only contains the completely unique records.
  • If there are records with duplicates of the selected field values, then ALL of those records come out of the duplicate stream.
You can download the macro and above sample module here, and look out for this macro in the next release of the Chaos Reigns Within (CReW) macro pack.


If you want to challenge yourself, then try to build the described macro without looking how I did it.  I suspect there are probably a lot of different approaches you could take.

I hope you find it useful.