Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to map the column values seperated by SubField

Hi Team,

I have 2 tables as stated below

table1:

Id     Name

1        A

2        B

3        C

table2:

Id

1,2,3

I am able to separate the comma separated values in table2 by using Subfield. but the Name corresponding to select table Id column comes out as only 'A'. However, it should reflect as 'A','B','C'. Kindly suggest the solution.

3 Replies
devarasu07
Master II
Master II

Hi,

try like this,

Table1:

load *,SubField(id,',') as Id;

load * Inline [

id

1,2,3

];

drop Field id from Table1;

Table2:

load * Inline [

Id,    Name

1,      A

2,    B

3,    C];

Capture.JPG

mbespartochnyy
Creator III
Creator III

I believe Inline table reads commas as column separator. If you replace commas with a pipe or something else, then it will work. Try this:

Table1:
LOAD *,
SubField(id,'|') as Id;
LOAD * Inline [
id
1|2|3
]
;
DROP Field id from Table1;



Table2:
load * Inline [
Id, Name
1, A
2, B
3, C]
;

MarcoWedel

Hi,

another example:

QlikCommunity_Thread_282892_Pic1.JPG

table1:

LOAD * Inline [

    Id    Name

    1        A

    2        B

    3        C

] (delimiter is spaces);

table2:

LOAD SubField(Id,',') as Id, SomeFact

Inline [

    Id      SomeFact

    1,2,3  fact1

    1,2    fact2

    1,3    fact3

    2      fact4

    4,5    fact5

](delimiter is spaces);

hope this helps

regards

Marco