Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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
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
Sorry Jonathan, I'm not sure what you mean...
See Susan Carter in extract from StoreEmployee below:
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
Thanks Jonathan for all your help 🙂