Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Joining / Merging / Concatenating a field in the same table

Good Afternoon Qlikview community,

Hopefully this is an easy one to solve. I have a table with several fields in and two of them hold simular data. I would like to merge these two fields together so they are one.

Here are some of the fields

Town

City

Departure

Arrival

Company Departure

Company Arrival

I would like Company Departure and Company Arrival as Company. so I thought it would be something like

 

TravelPlan:

LOAD

Town,

City,

Departure,

Arrival,

Company Departure AS Company,

Company Arrival AS Company


FROM...

But that did not work.

Any help would be highly appreciated.

Thanks again


Mark

1 Solution

Accepted Solutions
Gysbert_Wassenaar

If in a record only one of the two fields has a value you can concatenate them:

[Company Departure] & [Company Arrival] AS Company.

Otherwise you'll have to load the departures and arrivals separately in two loads:

Table:

LOAD Town, City, Departure, Arrival,

[Company Departure] AS Company

from ...somewhere...

where len(trim([Company Departure]))>0;

LOAD Town, City, Departure, Arrival,

[Company Arrival] AS Company

from ...somewhere...

where len(trim([Company Arrival]))>0;


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

If in a record only one of the two fields has a value you can concatenate them:

[Company Departure] & [Company Arrival] AS Company.

Otherwise you'll have to load the departures and arrivals separately in two loads:

Table:

LOAD Town, City, Departure, Arrival,

[Company Departure] AS Company

from ...somewhere...

where len(trim([Company Departure]))>0;

LOAD Town, City, Departure, Arrival,

[Company Arrival] AS Company

from ...somewhere...

where len(trim([Company Arrival]))>0;


talk is cheap, supply exceeds demand
jagan
Luminary Alumni
Luminary Alumni

Hi,

You should not give same name for two fields in a table, it throws an error.

TravelPlan:

LOAD

Town,

City,

Departure,

Arrival,

Company Departure AS Company,

Company Arrival AS Company


FROM...

So, you can give two different names for this two columns.  If Company Departure and
Company Arrival holds same data then there is no need of loading two columns, you can just load a single column.

Regards,

Jagan.

Not applicable
Author

Thank you Gysbert, That did the trick

tulasiram_bitra
Creator
Creator

Hi,

I loaded two tables. inbetween 2 tables i have written "add". Now i got combination of 2 fields data.

Is it right way?

jagan
Luminary Alumni
Luminary Alumni

Can you create a new thread and attach sample data/script and your expected result.

Regards,

Jagan.