Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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.

berkerdevirek
New Contributor II

concatenate two different table

Hi,

I have 2 tables,

Order_IDVoucherOwner
A1a
B2a
C3

b

Order_IDOwner
Db
Eb
Fb


I want to concatenate two table like this,


Order_IDVoucherOwner
A1a
B2a
C3b
D0b
E0b
F0b


How can I do that? One of the table is loaded from database and the other is from excel. I want to concatenate them at the front end.


Thanks,


Berker.

4 Replies
Not applicable

Re: concatenate two different table

Since one of the source don't have voucher and you can create the Vocher field while loading.

Please try Like below:

Let's voucher is in Missing in Excel file.

Data:

Select

     Order_Id,

     Voucher,

     Owner

From tablename;

Concatenate (Data)

Load

     Order_Id,

     0 as Voucher,

     Owner

From ExcelFiel

;

If Voucher is missing on the db table simple add dummy voucher value.

Re: concatenate two different table

Alternatively you can do the check after you have concatenated also:

Data:

Select

     Order_Id,

     Voucher,

     Owner

From tablename;

Concatenate (Data)

Load

     Order_Id,

     Owner

From ExcelFiel

FinalData:

LOAD Order_Id,

          If(Len(Trim(Voucher)) = 0, 0, Voucher) as Voucher

          Owner

Resident Data;

DROP Table Data;

berkerdevirek
New Contributor II

Re: concatenate two different table

I tried this one but I couldn't succeeded. I could get only excel or only qvd, the data after concatenate is not loaded to KARGO_BEDAVA.QVD

here is my code.

KARGO_BEDAVA:

LOAD

'$(vFIRMA)'&'|'&id as %KEY_CAMPAIGN_ID,

'b' as Sahip,

0 as Limit,

0 as kargo_karsilama;

SQL SELECT

id

FROM warehouse."public"."campaign_campaign";

Concatenate (KARGO_BEDAVA)

LOAD

  '$(vFIRMA)'&'|'&id  as %KEY_CAMPAIGN_ID,

  Sahip,

  Limit,

  kargo_karsilama;

LOAD [Kampanya ID] as id,

     Sahip,

     Limit,

     [Kargo Karsilama] as kargo_karsilama

FROM

[..\EXTERNAL\CRM Kurguları.xlsx]

(ooxml, embedded labels, table is Kargo);

MVP
MVP

Re: concatenate two different table

If you want a "concatenation" in the front end you don't need to do anything. Just load the two tables as is. It will create a Synthetic Key which good practice tells you that you should resolve - but for this purpose of illustrating the logic it is not necessary to do that:

2015-10-12 #2.PNG

I have enclosed a demo of it.