Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Highlighted
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
Honored Contributor II

Re: Creating a comma separated list

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

Re: Creating a comma separated list

May be like this

LOAD Value,

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

FROM ...

Frank_Hartmann
Honored Contributor II

Re: Creating a comma separated list

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

Re: Creating a comma separated list

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

Re: Creating a comma separated list

Thanks all.