This is the "Brute Force" method of getting the match. There has to be a better way... doesn't there?
LPARAMETERS cDialedNumber
LOCAL nCountryId
IF NOT SEEK(LEFT(cDialedNumber, 7), 'countries', 'ccode')
IF NOT SEEK(LEFT(cDialedNumber, 6), 'countries', 'ccode')
IF NOT SEEK(LEFT(cDialedNumber, 5), 'countries', 'ccode')
IF NOT SEEK(LEFT(cDialedNumber, 4), 'countries', 'ccode')
nCountryId = 0 && Invalid country code
ELSE
nCountryId = countries.id
ENDIF
ELSE
nCountryId = countries.id
ENDIF
ELSE
nCountryId = countries.id
ENDIF
ELSE
nCountryId = countries.id
ENDIF
RETURN nCountryId
Thanx,
Bill Elvin