Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

vchuprina
New Contributor II

How can I merge data from a few columns in one column

For example I have following table:

A                       B                  C

                      

Delivery            Color            StyleDesc

Dept                 ColorDesc    Store

Manufacturer     Style            StoreNumber

I want to merge  3 columns into one column, like this:

   D

Delivery           

Dept                

Manufacturer

Color     

ColorDesc

StyleDesc      

Store

StoreNumber

Please advise the best way

Thanks,

Vitaliy

3 Replies

Re: How can I merge data from a few columns in one column

Hi Vitaliy, this script creates a D field with those values:

LOAD SubField(A &';'& B &';'& C, ';') as D;

LOAD *

Inline [

A,B,C

Delivery,Color,StyleDesc

Dept,ColorDesc,Store

Manufacturer,Style,StoreNumber

];

hrlinder
Honored Contributor

Re: How can I merge data from a few columns in one column

use concat

load A as D

from ...

concatenate load B as D  (word concatenate not necessary as will be automatically concatenated by same fieldname D)

from ...

concatenate load C as D

from ...

sebastianlettne
Contributor

Re: How can I merge data from a few columns in one column

Hi,

you could use this code. It loads every column from a table into a single column and you don't have to write a load statement for each column.

Base:

LOAD * INLINE

[

A, B, C

Delivery, Color, StyleDesc

Dept, ColorDesc, Store

Manufacturer, Style, StoreNumber

];

for i=1 to NoOfFields('Base')

    Let FieldName = FieldName(i, 'Base');

   

    Target:

    LOAD

        $(FieldName) as Field

    Resident Base;

   

next i;

Regards

Sebastian Lettner

Community Browser