Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

joining multiple tables

I am new to qlik and over all coding, I complied data in 2 sheets in excel that look like below. sheet one shows as

 

sheet 1

  

WareHousePartNumQtyPriceLocWrrnty
a 251
a 1y
b 1 n
c5496 10
e6319727

sheet 2

  

  

WareHousePartNumQtyPriceLocWrrnty
a18683 y
a212187
b1296 1502
c10             3y
e n

I am trying to bring the information missing from sheet 2 into sheet one to

, this is what its creating which is technically correct, but I want it to sheet to have the according fields individually

      

WareHouseLocPartNumPriceQtyWrrnty
a1-25--
a1---y
a-1868-3y
a-212178-
b21296150--
b---1n
c3--10y
c-549610--
e7631927-
e----n

What is the solution to this ? I hope my question makes sense.

Please help and thanks in advance.

2 Replies
Nicole-Smith

Next time, you may want to include what you WANT the output to be.  It's hard to tell from your description exactly what you're looking for.  I'm going to give it a shot anyway.

The following load script:

Data:

LOAD WareHouse AS WareHouse1,

     PartNum AS PartNum1,

     Qty AS Qty1,

     Price AS Price1,

     Loc AS Loc1,

     Wrrnty AS Wrrnty1,

     RowNo() AS Row

FROM [example_data.xlsx] (ooxml, embedded labels, table is [sheet 1]);


LEFT JOIN (Data)

LOAD WareHouse AS WareHouse2,

     PartNum AS PartNum2,

     Qty AS Qty2,

     Price AS Price2,

     Loc AS Loc2,

     Wrrnty AS Wrrnty2,

     RowNo() AS Row

FROM [example_data.xlsx] (ooxml, embedded labels, table is [sheet 2]);


LEFT JOIN (Data)

LOAD Row,

IF(LEN(WareHouse1)>0, WareHouse1, WareHouse2) AS WareHouse,

IF(LEN(PartNum1)>0, PartNum1, PartNum2) AS PartNum,

IF(LEN(Qty1)>0, Qty1, Qty2) AS Qty,

IF(LEN(Price1)>0, Price1, Price2) AS Price,

IF(LEN(Loc1)>0, Loc1, Loc2) AS Loc,

IF(LEN(Wrrnty1)>0, Wrrnty1, Wrrnty2) AS Wrrnty

RESIDENT Data;


DROP FIELDS WareHouse1, WareHouse2, PartNum1, PartNum2, Qty1, Qty2, Price1, Price2, Loc1, Loc2, Wrrnty1, Wrrnty2, Row FROM Data;

Will return a data table that looks like this:

WareHouse PartNum Qty Price Loc Wrrnty
a18683251y
a2121871y
b129611502n
c549610103y
e6319727n

If this is not what you're looking for, please provide the output that you want.

Anonymous
Not applicable
Author

Yes Nicole, that is exactly how I was trying to get it to compile for future job issues. I was trying to get the missing information to cross from each table and reflect on 1 as you have.

Thank you so much for the srcipt,  there would be multiple ways to do the script, I guess it would be with what the person is familiar with.

Thank you so much!!!