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: 
Oguzhan
Contributor III
Contributor III

Load Data from 2 Tables and Delta Data

Hello, 

I have following problem. I have a excel file with 155 coloumns filled with data like below.

Table A:

Order_requestOrder NumberProject ID
135305561225

A

135306561231A
135307561233A
135343561235A
140610582309A
141107583893A
142373587627A
142374587629A

 

Then I have another Excel File with the same 155 coloumns filled with data like below

Table B:

Order_requestOrder NumberProject ID
132452551550A
135305561225A
135306561231A
135307561233A
135343561235A
134779562952A
138725573193A
132529580485A
140610582309A
141107583893A
141418585626A
142373587627A
142374587629A
142725588691A
142938589539A
142938589540A
143778592252A
143979592254A
144231593478A
143919594151A
144684594817A

 

Table A is my main table that contains a lot more Data than shown here so I cannot only load Table B,

What I need to load is all date in one table but the duplicate one like  the red highlighted Data because it appears in both tables. So I basically want to add the delta to my data without duplicating the whole dataset because some of the Order numbers can also be used in another Project B and if this happens I need the table be like.

The green Highlighted Data comes from another Project

Order_requestOrder NumberProject ID
132452551550

A

135305561225A
132452551550B

Thank you in Advance for your Help

Best regards

Oguzhan

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

You can use Where Not Exists in your table B load.  You need a key or composite key to evaluate if it's been loaded already.  If your composite key (call it %TableKey for example) is Order_request, Order_Number, Product_ID, you can do this... first load table A, create composite key, when loading B use same composite logic as your exsists expression and compare to the %tablekey for what has (not) been loaded already:

 

TableA:

Load *

,Order_request &'|' & Order_Number &'|' & Product_ID as %TableKey

From <your from statement A>

;

//table b load

Concatenate(TableA)

Load *

,Order_request &'|' & Order_Number &'|' & Product_ID as %TableKey

From <your from statement B>

Where Not Exists (Order_request &'|' & Order_Number &'|' & Product_ID, %TableKey)

;

View solution in original post

1 Reply
stevejoyce
Specialist II
Specialist II

You can use Where Not Exists in your table B load.  You need a key or composite key to evaluate if it's been loaded already.  If your composite key (call it %TableKey for example) is Order_request, Order_Number, Product_ID, you can do this... first load table A, create composite key, when loading B use same composite logic as your exsists expression and compare to the %tablekey for what has (not) been loaded already:

 

TableA:

Load *

,Order_request &'|' & Order_Number &'|' & Product_ID as %TableKey

From <your from statement A>

;

//table b load

Concatenate(TableA)

Load *

,Order_request &'|' & Order_Number &'|' & Product_ID as %TableKey

From <your from statement B>

Where Not Exists (Order_request &'|' & Order_Number &'|' & Product_ID, %TableKey)

;