Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

Joining 2 fields from 2 different tables

Hi, i need some help joining 2 fields from different tables.

My tables are as follows

LOAD

StoreNumber,

TransId,

EmployeeId

FROM

C:\QLIKVIEW\Transaction.csv

LOAD

StoreNumber,

EmployeeName

FROM

C:\QLIKVIEW\Employee.csv

I want to create a new field called STOREEMPLOYEE from EmployeeId (from the first table) and EmployeeName (From the second table)

Can anyone tell me how to do thsi please?

14 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Here's a sample script:


MYTABLE:
LOAD EmployeeID,
StoreNumber,
...
FROM POSTTransactionHeader;

INNER JOIN (MYTABLE)
LOAD EmployeeName,
StoreNumber,
...
FROM StoreEmployee;


This will join correctly on StoreNumber, but I am still a little concerned that you are going to get a cross join between EmployeeID and EmployeeName (ie each employeename for each store joined to every employeeID for that store) - which I assume is not what you want.

I would use the list boxes I suggested in an earlier post to check the results.

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

On checking the model you uploaded, you already have the store, ID and name together in the Store Employee table. The key appears to contain the store number and employeeID, and the name is (of course) in the EmployeeName field. Just split out the two values from the key and you have it (SUBFIELD or string manipulation).

No joins required!

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Sorry Jonathan, I'm not sure what you mean...

jonathandienst
Partner - Champion III
Partner - Champion III

See Susan Carter in extract from StoreEmployee below:

  • key value 16695 - 3 (store 16695, employee ID 3)
  • EmployeeName - Susan Carter

So:

Store number = Num#(Left(%lkStoreEmployee, 5))

Employee ID = Num#(Mid(%lkStoreEmployee, 9, 5))

Employee name = EmployeeName

(Assumes that this data is representative the whole set)

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Thanks Jonathan for all your help 🙂