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

Alteryx Designer Desktop Discussions

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

group by macro issue when only one input

Mikis
8 - Asteroid

Hello,

 

the company i work for does market research, and every datafile has differently named fields.

The concept "region" can be "country_code" or "ccode" or "region_code", whatever comes to the pm's mind :)

 

That's why all my flows need to be very dynamic and I always work with the raw xml.

 

One of my macro's (attached) takes a list of fields and converts them all to a "group by" XML.

 

If i enter "variableA" & "variableB" into my macro, then it would return 

<SummarizeField field="variableA" action="GroupBy" rename="variableA" /> <SummarizeField field="variableB" action="GroupBy" rename="variableB" />

 

The issue is that I always assumed there would be multiple fields, and it breaks when there is only one (it gives an error when I just enter "variableA".

I can adapt it so that it accepts one field, but then it breaks when there are multiple fields :D

 

Can anyone give a tip on how to rewrite this macro, so that I can enter both one and multiple fields?

 

thanks!

Mikis

2 REPLIES 2
patrick_digan
17 - Castor
17 - Castor

@Mikis I setup the attached workflow and macro as I think these are what you're looking for based on your post. If I've missed something, let me know. I wasn't able to run your macro as it had a nested macro, so you would just need to upload that Dynamic Text to columns macro as well if my macro isn't working and I need to further look at your macro. 

Mikis
8 - Asteroid

@patrick_digan holy moly what a clean and simple solution

looking back at my own dragon of a macro, I wonder what I was thinking :D

Labels