Alteryx Macros Example 2 - Finding Number of Columns for Text to Columns Tool - Part 2

by Liu Zhang

To improve the macro build in the previous blog, we will incorporate the ability to adjust the number of columns. For this we will need Control Parameter tool from Interface tool.

Control Parameter

The tool has no configuration, it is used to create a Batch Macro from a Standard Marco, it is used to take in new input from outside the current macro for process.

Note: The tool will force the workflow to be a Batch Macro.

Let's connect the Control Parameter into the Text to Columns tool to update the number of columns that we want to split.

Update Text to Columns

Now with the inner macro configuration done, we will need to setup an outer macro to give input for the control parameter.

Nested macro

We see the workflow is identical to the one in Part 1, except we replaced the Text to Columns tool to our inner macro.

Because the Batch Macro, we need to tell it what to group (batch) by, where the ¿ is the feed for Control Parameter, so let's give it the input number of columns that we want to split.

Special case when there is no delimiter

Once we have the count, we can Summarize as before to find the max count among all rows of input data.

Update Max Count to the correct number

Now the outer macro will compute the max number of columns needed based on the chosen delimiter, then it feeds these two information into the inner macro as built from the previous blog.

Workflow

There are in fact a special case need to be considered, which we will left to the next part to discuss. The current macro already does the basic function we would like it to perform.


Looking for more guides, tips and tricks in Tableau or Alteryx? Go check out the other blog posts from the Data School.

Tableau Public

LinkedIn

Twitter

Tue 14 Dec 2021

Sun 03 Oct 2021

Tue 28 Sep 2021