For our 4th week Friday project, we were asked to create as many macros based on tableau table calculations as possible in 3 hours.

While completing my first macro (rank unique), I wanted to have an option to allow the user to be able to choose the field that they wanted to rank. However, when I linked the output node of the input macro to the dropdown box:

First try – didn’t work

the drop-down box in the macro would only give the fields of the sample data I originally used to create the macro (i.e. the fields in “Sample – Superstore.xls”). This worked fine when I wanted to use the macro to rank things for this data but when I connected this macro to another data source, it would error as it needs the fields to match.

After trying a couple of methods:

Still didn’t work

and finding no success, given the time-limited nature of our project, I moved on and decided to just use text boxes so the user could write the field they want to rank.

It works but it wasn’t ideal

So I woke up this morning with a simple idea – why don’t I look at some of the macro’s inside Alteryx itself to see how they do it. I decided to look at the Cleanse tool expecting something complex and started to kick myself when I saw how simple it was (and for not thinking to do this sooner):

Underneath the macro input tool, there’s a symbol that you can connect to a Drop Down or List Box tool to use the fields in whatever is connected to the macro’s input node. So all I had to do was this: