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

Dynamic Append Fields

RayAU
5 - Atom

Hi Everyone, 

 

I am trying to do a dynamic append fields but can't figure out how to do it in Alteryx:

 

The source looks like this: 

dynamicappend.png

The column field determines in which column the name row belongs to. 

 

And desired results: 

results.JPG

 

 

Challenge: The numbers of columns needed to be created is not known in advanced as the source varies - so I cannot put a certain amount of Append Fields or Text to Columns tools in advance. 

How can I create the same result dynamically. 

 

Thank you in advance for your help. 

 

 

4 REPLIES 4
jdunkerley79
ACE Emeritus
ACE Emeritus

Bit fiddly, my first guess is to use an iterative macro to do the cartesian joins to make the big set with a single concatenated string value representing each column:

2016-06-28_08-46-15.jpg

 

After this take the output and split on the separator to rows followed by a cross tab

 

Bit fiddly hopefully the sample package attached (macro, datafile, and sample) will help.

patrick_digan
17 - Castor
17 - Castor

Nothing wrong with @jdunkerley79's method, but I used a different method to avoid concatenating. I used the iterative macro to loop through all the different possible combinations. I've attached my sample workflow using the same data.

 

There is always more than one way to do it!

JohnJPS
15 - Aurora

Here's yet another approach, using the R tool:

 

df <- as.data.frame(read.Alteryx("#1", mode="data.frame"))
df1 <- expand.grid(split(df$Rows, df$Column))
write.Alteryx(df1, 1)

PS: credit for this goes to StackOverflow

 

RayAU
5 - Atom

Thank you so much jdunkerley79, patrick_digan and JohnJPS for your solutions.  

All very useful for my learning and current project. 

 

Cheers, 

 

Ray

 

Labels