Automate Populating Select Lists in Alteryx

In today’s post and video I’m going to share a quick way to rapidly populate the select tool in Alteryx if you need to change the data type or rename a bunch of fields in your data stream.  While Alteryx’s visual interface does result in extremely simple and intuitive workflows, one downside for hard-core developers is the loss in productivity experienced by using a GUI vs. generating code directly.  Fortunately there are some workarounds…

Imagine that you have a dataset with over 100 generic column names.  You already know the final set of column names that you’d like to use, the question is how can you quickly overlay the new names over the old column names in you data.  Below is a screenshot showing the normal manual method for renaming each field or change the data type using the select tool.

Of course that’s all well and good, except you don’t want to have to manually type all the new names in.  If you want to do a bulk change, then you can use the Safe Field Configuration option.

The result is an XML file containing all the information that went into configuring the select node.

Now that you’ve essentially converted the GUI into a text-based code file, you can easily manipulate that in a more automated fashion.  In my example, I pasted the XML text into Excel and used a formula to rebuild the text strings substituting my new field names for the old field names.  Below you can see my new field names on the left, which are referenced when concatenating the new XML text strings.

Once the formula was built, all I had to do was copy it down for every field and then copy the entire set of new XML strings back into the original text file.  Finally, I just switched back to Alteryx, selected the Load Field Names option, and imported my new field names which now show up in the select node for all 100 columns.

 

For further details, feel free to watch the tutorial video I created.

Follow me on twitter to subscribe to future posts: @SculptingData

 

 

This entry was posted in Alteryx, Excel. Bookmark the permalink.

Leave a Reply