Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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.

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

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
Champion III
Champion III

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.