Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Understanding macros

Peter4
8 - Asteroid

I'm having a hard time understanding Alteryx macros. I have read most of the documentation yet I don't seem to be able to build a functioning standard macro and frankly the tools are a mess.

 

I have a very, very simple macro workflow with a formula tool that times a field by 2. I'd like to input that into any other workflow and select the columns I want to multiply. Yet for some reason I have two input anchors and an interface that wants to group my data.

 

Any help would be appreciated.

8 REPLIES 8
grossal
15 - Aurora
15 - Aurora

Hi @Peter4,

 

there were two input anchos because it wasn't a standard macro, it was selected to be a Batch-Macro.

 

grossal_0-1586538719090.png

 

Second:

You can remove your Interface-Tools to achieve this behaviour:

 

grossal_1-1586538749660.png

 

You can than click on the Macro-Input and select "Show Field Map".

 

grossal_2-1586538866480.png

 

This will enable a dialog in the configuration of the macro when you use it:

 

grossal_3-1586538900287.png

 

You can easily pick the column here and get the result you want!

 

Example Input: (I picked Field1 to be doubled) 

 

grossal_4-1586538974776.png

 

Example Output:

grossal_5-1586538986077.png

 

 

 

Fixed Macro attached. Let me know if I got it right.

 

 

Best

Alex

 

PS: Cool Macro-Icon!

Peter4
8 - Asteroid

Great thanks! I think it switched to a batch macro because I dragged the control parameter tool onto the canvas. How can I keep the name of my original field without replacing it with "example" in this case?

grossal
15 - Aurora
15 - Aurora

You could achieve this using an Action Tool in combination with a Select Tool:

 

grossal_0-1586540022014.png

 

The default setting "Update Select with Reverse Field Map (Default)" does the job. This will rename the column to the original name.

 

grossal_1-1586540049585.png

 

The output now looks like this:

grossal_2-1586540094472.png

 

I'll attach the adapted version.

 

Best

Alex

Peter4
8 - Asteroid

Perfect, thank you!

Peter4
8 - Asteroid

What if I wanted to update the number in my macro? Do I select update value or update formula?

grossal
15 - Aurora
15 - Aurora

I do it this way:

 

I changed the formula back so they would work even in the test run in the macro itself.

 

grossal_0-1586542330281.png

 

 

You can use the "Update Value (Default)" and the Option "Replace a specific string". Remove everything from the String besides the thing you want to be replaced - in this case 125. The Tool will now swap 125 and the number you picked in your Numeric Up Down Picker..

 

grossal_1-1586542355772.png

 

Updated Macro attached.

 

Best

Alex

Peter4
8 - Asteroid

Thank you. I think I'm getting the hang of it.

 

What does 'Update Value with formula' do? Or how could I practise usnig that?

grossal
15 - Aurora
15 - Aurora

To be honest, I have never used the 'Update Value with formula'. Usually you just want to replace a specific part of something and can do this with the 'Replace specific String' Option.

 

I could see use cases if you would like to use something like a Regex-Replace or Regex-Match, but to be honest again, I would do this different and not do it with the 'Update Value with formula' option.

Labels
Top Solution Authors