Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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
Not applicable

Assuming StoreNumber is the key between these two tables.
EMPTRN:
LOAD

StoreNumber,

TransId,

EmployeeId

FROM

C:\QLIKVIEW\Transaction.csv;
Left join
LOAD

StoreNumber,

EmployeeName

FROM

C:\QLIKVIEW\Employee.csv;

EmpFinal:
Load *,
EmployeeId & EmployeeName as STOREEMPLOYEE
resident EMPTRN;
drop table EMPTRN;

llauses243
Creator III
Creator III

To use "EmployeedId as STOREEMPLOYEE" in a the next help ...

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Is what you want even possible?

For any given storenumber, how will you know which EmployeeName relates to which EmployeeID? (Unless there is never more than one employee per StoreNumber)

Jonathan

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

Yes it is possible, It already works great, but with 2 seperate tables (1 for EmployeeId and 1 for Employee Name)

What i inlcuded earlier was only a tiny bit of my script, here is an image of my linked tables...

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Hi, this will not work as i need to keep the both tables as they have more fields that i require in my script. What i have included in my original post is only a portion of it. There are about 25 fields in the table.

These 2 tables are not linked directly

jonathandienst
Partner - Champion III
Partner - Champion III

Two separate tables might work - that does not imply that you can combine them into one.

You need to have some way of determining which EmployeeID maps to which EmployeeName - although I did not see an EmployeeID on the model.

One way to test this is to have a sheet showing 3 listboxes: StoreNumber, EmployeeID and EmployeeNumber. Play around withe selections on that and you'll see what I mean. I expect that if you select an employeeID, you'll see more than one name.

I am assuming that there is not some sort of denormalisation in your datasource, or in your load script.

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, The employeeId is within the POSTransactionHeader, The table image i attached is limited, there are 20+ fields within most of the tables.

An employee name and ID are linked to a store number, So before the end user selects an employee they will first select a store number which then only displays employees relevant to that store.

jonathandienst
Partner - Champion III
Partner - Champion III

Okay, maybe the example in the initial post misled me. But I see no problem here, or do you need some guidance on the syntax of joining tables?

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

Yes please if you don't mind. Maybe i should have explained it in my initial post a bit better! 🙂

I know how to join fields within the same table, But i have never done it for fields from different tables.

Here is my QVW

I want to link

EmployeeId From POSTransactionHeader with

EmployeeName From StoreEmployee

Your help is very appreciated!