Click or drag to resize

lookup Function

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
lookup Function

The lookup function returns a value specified by a unique key.

If no value is associated with the key lookup will return null.

Syntax

Alchemy
lookup(look_tbl, key);

Nomenclature

look_tblThe name of the lookup table to search
keyThe search key

Example

The following code creates a lookup table based on cities using the post (ZIP) code as a key.

This would allow us to find a city for a given post code.

Alchemy
CREATE LOOKUP cityByPostcode
  ON %city
  FROM "data\California"
  INDEX BY %postcode;

Using the lookup function, we can now match a post code to a city:

Alchemy
lookup(cityByPostCode, "92656");

The above example would (knowing that the post code 92656 is in the city of Aliso Viejo) return 'Aliso Viejo'.

To make it easier to use the same lookup function across several files, you can save and then load a lookup that you have previously created.

To save the lookup, use the following statement:

Alchemy
SAVE LOOKUP cityByPostcode AS "Lookups\CityFromPostcode.db";

To load the lookup, use the following statement:

Alchemy
LOAD LOOKUP cityByPostcode FROM "Lookups\CityFromPostcode.db";