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: 
praveen2410
Contributor
Contributor

Using a Loop to load data

Hi Everyone,

I have a requirement where I have data in this format 

A 1,2,3
4,5,6,7
C 8,9

and I'd like to change it to 

A 1
A 2
A 3
B 4
B 5
B 6
B 7
C 8
C 9

I also have to factor in that I do not know how many values will be present in the second column for me to do a for loop with a constant number of iterations. How can I implement this?

Labels (2)
1 Solution

Accepted Solutions
HillVi
Partner - Contributor II
Partner - Contributor II

No need for a loop!

You can use the SubField-function to achieve this, eg:

TEST:

LOAD 

FIELD1,

    subfield(FIELD2, ',') AS FIELD2;

Load * inline [

FIELD1 FIELD2

A 1,2,3

B 4,5,6,7

C 8,9

](delimiter is '\t');

Should lead to this

HillVi_0-1708410750138.png

 

View solution in original post

1 Reply
HillVi
Partner - Contributor II
Partner - Contributor II

No need for a loop!

You can use the SubField-function to achieve this, eg:

TEST:

LOAD 

FIELD1,

    subfield(FIELD2, ',') AS FIELD2;

Load * inline [

FIELD1 FIELD2

A 1,2,3

B 4,5,6,7

C 8,9

](delimiter is '\t');

Should lead to this

HillVi_0-1708410750138.png