Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating a comma separated list

Hi All,

I'm looking to perform the following task in QV:

  

ValueNew Column
AA
BA,B
CA,B,C
DA,B,C,D
EA,B,C,D,E

How can i achieve this ? I imagine there is a previous command involved. Just unsure as to how to frame the logic.

All suggestions are welcome. Thanks


V

1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

or maybe:

LOAD *,

if(Peek('New Column')<>Null(),Peek('New Column'),Null())& Value as [New Column];

LOAD * INLINE [

    Value

    A

    B

    C

    D

    E

];

View solution in original post

4 Replies
sunny_talwar

May be like this

LOAD Value,

Alt(Peek('New Column'), '') & ',' & Value as [New Column]

FROM ...

Frank_Hartmann
Master II
Master II

or maybe:

LOAD *,

if(Peek('New Column')<>Null(),Peek('New Column'),Null())& Value as [New Column];

LOAD * INLINE [

    Value

    A

    B

    C

    D

    E

];

sunny_talwar

My intentions were right, but I should have thought through or tested my code .

Slight improvement

Table:

LOAD *,

Peek('New Column') & Value & ',' as [New Column];

LOAD * INLINE [

    Value

    A

    B

    C

    D

    E

];

FinalTable:

NoConcatenate

LOAD Value,

Left([New Column], Len([New Column]) - 1) as [New Column]

Resident Table;

DROP Table Table;

Capture.PNG

Not applicable
Author

Thanks all.