Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
marcel_olmo
Partner Ambassador
Partner Ambassador

Dynamic word combination

Hi guys,

I have a list of words like this :

a,e,i,o,u,1,2,3,4,5

and I'd like to have a new word of 5 character lenght with all the possible combinations dynamically.

Example :

Id,NewWord

1, aaaaa

2,aaaae

....

Anybody here knows how to do that avoiding to do it with 5 nested for next loops? The point here is my issue is much complicated than this, and maybe there's a string function that will do what I want.

Regards, Marcel.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe using an outer JOIN to create all combinations:

Words:

LOAD * INLINE [

Word

a,

e,

i,

o,

u,

1,

2,

3,

4,

5

];

For i = 1 to 5

If i = 1 THEN

Prefix = 'Combinations:'

ELSE

Prefix = 'Join (Combinations)';

endif

$(Prefix)

LOAD Word as Word$(i) Resident Words;

Next i

If needed, you can concatenate each WordX to create a single field for the combinations in another step.

View solution in original post

2 Replies
swuehl
MVP
MVP

Maybe using an outer JOIN to create all combinations:

Words:

LOAD * INLINE [

Word

a,

e,

i,

o,

u,

1,

2,

3,

4,

5

];

For i = 1 to 5

If i = 1 THEN

Prefix = 'Combinations:'

ELSE

Prefix = 'Join (Combinations)';

endif

$(Prefix)

LOAD Word as Word$(i) Resident Words;

Next i

If needed, you can concatenate each WordX to create a single field for the combinations in another step.

marcel_olmo
Partner Ambassador
Partner Ambassador
Author

Thanks Stephan, it's what I need. I'll concatenate each wordX in a resident load after it.

Best regards, Marcel.