Page 1 of 1

Advanced LOOKUP question

Posted: Wed Sep 07, 2005 3:35 pm
by jmiskey
This can be explained best by an example.____Let^s say I have a table called MAINTABLE.DBF, and two other tables named TABLE1.DBF and TABLE2.DBF. Each of these table have Employee IDs in them. In MAINTABLE, the Employee ID field is a unique field, but they are not in the other two tables. So creating any sort of relationships from the MAINTABLE to the other tables would be a One-to-Many relationship.____Now, I need identify all Employee ID^s in the MAINTABLE that do not have any matches in either TABLE1 or TABLE2 (if they are found in either one of these tables, do NOT return them). To further complicate matters, sometimes TABLE2 does not exist. So I only want to check this table if it exists.____In a nutshell, here are my conditions for the records I would like to return:__Starting from the MAINTABLE.DBF, return all records where:__1. A matching Employee ID is not found anywhere in TABLE1;__AND__2. If TABLE2 exists, check and return only if Employee ID is not found in TABLE2.____How would I do this? I thought maybe with LOOKUP formulas, but am not sure if you can use LOOKUP formulas where a One-to-Many relationship exists.____By the way, I am using Version 10.____Thanks.

=> RE: Advanced LOOKUP question

Posted: Fri Sep 09, 2005 7:02 am
by kfleming
Even if it is a one to many, you could do a lookup function for the first relation and if it comes back empty, then there was not a matching record in the first file.____Doing the same for the second would give you back a no match both when there really is not a match and also when the second file does not exist. I do not know of an easy way to verify the existence of a file other than you might be able to build a CDLL()calculation that calls a windows function. But this is not something that I have done before.____Kathleen__R&R Support