We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Create combinations from the input data

ADINAVAHI
6 - Meteoroid

Hello All,

 

I have a problem statement where in I have to create combinations from the input data received. My input data is as follows

 

KeyIDValue
AB11a,b
AB12a,b,c
AB13a,b,c,d
A14c,d

 

I would need the output combinations in the required format

 

KeyIDValueCombination1Combination2Combination3Combination4Combination5Combination6Combination7combination8combination9
AB11a,bab        
AB12a,b,cabacbcabc     
AB13a,b,c,dabacadbcbdcdbcdabcd 
A14c,dcd        

 

The delimiters in value might not always be the same and would keep varying

 

Can you please provide an approach on how this could be achieved. Would really appreciate your help

 

Thanks and Regards,

Abhishek Dinavahi

4 REPLIES 4
Drussek
9 - Comet

@ADINAVAHI don't you need any other 3 letter combinations: abc, abd, acd?

How many maximum elements can there be in Value?

ADINAVAHI
6 - Meteoroid

Hi Drussek,

 

The a,b,c combinations are just an example. The value column can contain any value

 

In response to the number of delimiters, in our case",", its not defined. A row might have 2 delimeters while another row might have 20

 

 

mst3k
11 - Bolide

If you need all possible permutations of the individual elements, you can isolate the individual values, then chain Append tools to reach the correct solution for each set, filtering out repeats if those are not supposed to be possible (i.e   aaa).

You could generalize that even more if you wanted to, by creating an iterative macro that dynamically repeats the Append+FilterRepeats the appropriate number of times.

 

Weekly challenge #270 is a similar case of doing those permutations

Drussek
9 - Comet

The result of the attached solution is written in lines due to the potentially huge number of combinations for e.g. 20 items. This is probably not the best solution, but maybe it's enough for a start?

Labels
Top Solution Authors