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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Rdouto
Contributor II
Contributor II

Merge several field

Hello,

I would like to merge 3 differents fields into 1, just like that : 

Rdouto_0-1599126762288.png

I need to keep all the values, they don't have to be distinct.

Thank you

4 Replies
Taoufiq_Zarra

@Rdouto 

One solution :

Input:

load *,subfield(TmpField,'_') as Result;
LOAD *,[Field 1]&'_'&[Field 2]&'_'&[Field 3] as TmpField INLINE [
    Field 1, Field 2, Field 3
    2, 1, 4
    5, 4, 5
    4, 9, 6
    9, 3, 8
    7, 8, 7
    6, 2, 1
];

drop fields TmpField,[Field 1],[Field 2],[Field 3];

output:

 

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Kushal_Chawda

@Rdouto You need to use concatenate here to have other field reference intact

Data:

load Field1 as Field,A,B,C

FROM table;

concatenate(Data)

load Field2 as Field,A,B,C

FROM table;

concatenate(Data)

load Field3 as Field,A,B,C

FROM table;

Rdouto
Contributor II
Contributor II
Author

Thank you for your answers ! 

I tried the first proposition @Taoufiq_Zarra  but the system says that he does not know the field Tmpfield. Maybe I forgot something ?

Rdouto_0-1599141507484.png

 

Taoufiq_Zarra

like this ?

[All forms]:

load *,subfield(TmpField,'_') as Result;
load *,[Field 1]&'_'&[Field 2]&'_'&[Field 3] as TmpField 

From[lib.....

drop fields TmpField,[Field 1],[Field 2],[Field 3];
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉