I can't believe I'm having such a hard time getting this to work! It's SO much easier in dBase/FoxPro!! (ok, I feel better now)
I need to take what a user enters in a field (Company) and look it up to see if it already exists so I can stop them from entering duplicates (numerous ones already exist so I can't change the Key in the Dictionary).
I read somewhere that you have to create aliases in order to do key lookups, so I created one for the COMPANY file. This is what I've been trying:
! Check for existing COMPANY
IF LocalRequest = InsertRecord
! Open secondary Company file
OPEN(COMPANYALIAS)
COMALIAS:Company = CO:Company
! Check if Company key exists
GET(COMALIAS:CompanyKey,COMALIAS:Company)
IF NOT EOF(COMPANYALIAS)
MESSAGE('Company Found: ' & COMPANYALIAS:Company)
CYCLE
ELSE
MESSAGE('Company NOT Found: ' & COMPANYALIAS:Company)
END
END
Why isn't this working? It keeps coming up "Company NOT Found" for existing and non-existing values and never hitting EOF on the alias.
I need to take what a user enters in a field (Company) and look it up to see if it already exists so I can stop them from entering duplicates (numerous ones already exist so I can't change the Key in the Dictionary).
I read somewhere that you have to create aliases in order to do key lookups, so I created one for the COMPANY file. This is what I've been trying:
! Check for existing COMPANY
IF LocalRequest = InsertRecord
! Open secondary Company file
OPEN(COMPANYALIAS)
COMALIAS:Company = CO:Company
! Check if Company key exists
GET(COMALIAS:CompanyKey,COMALIAS:Company)
IF NOT EOF(COMPANYALIAS)
MESSAGE('Company Found: ' & COMPANYALIAS:Company)
CYCLE
ELSE
MESSAGE('Company NOT Found: ' & COMPANYALIAS:Company)
END
END
Why isn't this working? It keeps coming up "Company NOT Found" for existing and non-existing values and never hitting EOF on the alias.