Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Append Values between Two or More Columns


Hi,

I am trying to get the the values from two different one-column tables merged or appended under one column. I tried Contcatenate, Joins, and other functions. It did not work. I am trying to get help from this forum.

There are situations:

Situation A:

Data1:

Load * Inline
[Customer1
A
B
C
D
]
;

Data2:
Load * Inline
[Customer2
E
F
G
H

A

B

C
]
;

I want to merge the above two tables. The values in Customer2 table must append the values in Customer1 table. The final result must look like this.

Customer
A
B
C
D
E
F
G
H
A
B
C

Situation 2:

Table1:

Load

     if(condition=TRUE, ValueA) As Field1,

     if(condition=TRUE, ValueB) As Field2,

     if(condition=TRUE, ValueC) As Field3,

     if(condition=TRUE, ValueD) As Field4,

Resident SampleTable;

How do I get all the values in each separate fields to be appended to each other. The final result must append all the 4 values under one column, and must look like this:

AllValues
ValueA
ValueB
ValueC
ValueD

I appreciate any assistance.

Thanks,

Raghu

9 Replies
Anonymous
Not applicable
Author

The name of the columns have to be the same, see table2 is Customer1 as well

Data1:

Load * Inline

[Customer1

A

B

C

D

];

concatenate(Data1)

Data2:

Load * Inline

[Customer1

E

F

G

H

A

B

C

];

Table2:

load

Concat(if(Customer1='A' or Customer1='B' or Customer1='C', Customer1)) as ValueA,

Concat(if(Customer1='D' or Customer1='E' or Customer1='F', Customer1)) as ValueB,

Concat(if(Customer1='G' or Customer1='H', Customer1)) as ValueC

Resident Data1;

DROP Table Data1;

Regards,

Oscar

robert_mika
Master III
Master III

In your first case how would you know if the first A is for cust 1 or 2?

This is against principle rule that the table should have only unique values.

mrossoit
Creator II
Creator II

Hi,

try this:

Situation A:

Data:

Load * Inline
[Customer
A
B
C
D
]
;

Load * Inline
[Customer
E
F
G
H

A

B

C
]
;


Situation 2:

Table1:

CrossTable(Description,AllValues,1)

Load 1 as tmp,

     if(condition=TRUE, ValueA) As Field1,

     if(condition=TRUE, ValueB) As Field2,

     if(condition=TRUE, ValueC) As Field3,

     if(condition=TRUE, ValueD) As Field4,

Resident SampleTable;

drop fields tmp, Description;

Hope it helps

Regards

MR

Not applicable
Author

Hi Oscar,

Thanks for your response. It seems my question may not have been as clear. I will repost this again with more explanation. But your response partially helped me understand some QlikView load scripts.

Thanks,

Raghu

Not applicable
Author

Hi MR,

Thanks for your response. It seems my question needs more elaborate explanation. But your response partially helped me understand some QlikView load scripts.

Thanks,

Raghu

mrossoit
Creator II
Creator II

What are your other doubts or requires?

Not applicable
Author

Hi MR,

I posted another question that is related to this one in QlikView Community.

How to Concatenate values in different columns into One Column

Thanks,

Raghu

mrossoit
Creator II
Creator II

I read that Sunindia gave you the answer. There's anything else I could do for you?

Not applicable
Author

Hi MR,

At present I am fine. Thank you for asking.

Thanks,

Raghu