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
KeyID | Value |
AB11 | a,b |
AB12 | a,b,c |
AB13 | a,b,c,d |
A14 | c,d |
I would need the output combinations in the required format
KeyID | Value | Combination1 | Combination2 | Combination3 | Combination4 | Combination5 | Combination6 | Combination7 | combination8 | combination9 |
AB11 | a,b | ab | ||||||||
AB12 | a,b,c | ab | ac | bc | abc | |||||
AB13 | a,b,c,d | ab | ac | ad | bc | bd | cd | bcd | abcd | |
A14 | c,d | cd |
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
@ADINAVAHI don't you need any other 3 letter combinations: abc, abd, acd?
How many maximum elements can there be in Value?
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
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