Self-Join Type Lookup

I am a database designer and use self-joins on a regular basis. I am trying to use this idea in my app. Here is the scenario: I have a list of employees, one of the columns is their supervisor employee number. I need the lookup to take the supervisor number of the employee and look back at the same employee list to get the supervisor name. I hope that makes sense? Any help is appreciated. Right now, my workaround was a vlookup in the Sheet, but I would like to avoid that. Thanks.

The Supervisor column should be set as a Ref type column, pointing to the Employees table.

Thanks for that, but the Supervisor column is an auto fill-in from a Ref column as Employee Number. So, the Employee Number in my app is a Ref to the EmployeeNumber in this sheet…Then, I auto fill as much information as possible, including the Supervisor Number. I need the Supervisor number to lookup back to FirstName and LastName to display the name of the supervisor.
I hope that explains it better. Thanks again.

So you have another table that is referencing an Employee?
Sounds like you need to use a dereference expression.

can you give an example?

Supervisor is a column in the table with this value: [EmployeeNumber].[Supervisor],
Employee Number is a Ref column.
I want this to bring in the first name of the supervisor.
LOOKUP([Supervisor], “Allemps”,“EmployeeNumber”, “firstname”) seems like it would work, but does not bring back an first name.

this works:
LOOKUP(“30267”, “Allemps”,“EmployeeNumber”, “firstname”) (brings in the supervisor’s name with emp number 30267

and 30267 is what is displaying in the supervisor field so really
LOOKUP([Supervisor], “Allemps”,“EmployeeNumber”, “firstname”) seems like it would work, but does not bring back an first name.

Should you be using [_THISROW]?

1 Like

that is it…thanks again

1 Like