Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

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

];

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

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

];

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.

Community Browser