Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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

Tags (2)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Not applicable

Re: Joining / Merging / Concatenating a field in the same table

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
5 Replies
Gysbert_Wassenaar
Not applicable

Re: Joining / Merging / Concatenating a field in the same table

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
Not applicable

Re: Joining / Merging / Concatenating a field in the same table

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

Re: Joining / Merging / Concatenating a field in the same table

Thank you Gysbert, That did the trick

tulasiram_bitra
Not applicable

Re: Joining / Merging / Concatenating a field in the same table

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
Not applicable

Re: Joining / Merging / Concatenating a field in the same table

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

Regards,

Jagan.