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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Recursive store

Hi,

i have an input table like this:

Key1Key2
A1
B2;3
C4;5;6

I need to create a table like this:

Key1Key2
A1
B2
B3
C4
C5
C6

Which is the best way to achive the goal'

Many thanks!

1 Solution

Accepted Solutions
Not applicable
Author

Hi Romeo,

this script should work as aspected:

RawData:

LOAD * Inline [

Key1, Key2

A,1

B,2;3;4

C,4;5;6

];

Result:

LOAD

    Key1    AS Res1,

    SubField(Key2, ';', IterNo())    AS Res2,

    RowNo()    AS ResKey

Resident RawData

While SubStringCount(Key2,';') >= IterNo()-1

;

DROP Table RawData;

HtH

Roland

View solution in original post

2 Replies
Not applicable
Author

in your script, write this

LOAD

    subfield(Key2,';') as Key2

Resident

Not applicable
Author

Hi Romeo,

this script should work as aspected:

RawData:

LOAD * Inline [

Key1, Key2

A,1

B,2;3;4

C,4;5;6

];

Result:

LOAD

    Key1    AS Res1,

    SubField(Key2, ';', IterNo())    AS Res2,

    RowNo()    AS ResKey

Resident RawData

While SubStringCount(Key2,';') >= IterNo()-1

;

DROP Table RawData;

HtH

Roland