Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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.
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.
Thanks Stephan, it's what I need. I'll concatenate each wordX in a resident load after it.
Best regards, Marcel.