Table Look-up Expressions

Two additional table manipulation functions (findrow and tablelookup) are also available. These table look-up functions can read from CSV files and are not included on the Operators tabs of the Math Expression Builders.

Function

Description

findrow

(tablename,fieldname,match)

Find a row in a table file that matches your value for the specified field. Note that the first row is 0 (zero).

tablelookup

(tablename,fieldname,row)

Retrieve a value from a table file.

When using the table look-up expressions, the "tables" are identified by name. In the examples below, we will refer to the “datum.csv” table. To provide additional help, we have included the first six lines of the “datum.csv” table. Note that, the first row of the table file is the channel (column) header information.

Table 'datum.csv ':

Datum,Code,ESRI,MapInfo,Area_of_use,Geoid,Ellipsoid,Prime_meridian,Datum_trf

*Airy 1830,4001,D_Airy_1830,0,Ellipsoid,,Airy 1830,0,

*Airy Modified 1849,4002,D_Airy_Modified,0,Ellipsoid,,Airy Modified 1849,0,

*AMMP/SAMMP grid,,,0,"Africa,South America",,*AMMP/SAMMP,0,

*Australian National Spheroid,4003,,0,Ellipsoid,,Australian National Spheroid,0,

*Authalic Sphere,4035,,0,Ellipsoid,,Sphere,0,

Table Look-up Examples:

       findrow (“datum”, “Code”, “4003”) would return 3 (row 3)

       findrow (“datum”, “Datum”, “AMMP/SAMMP grid”) would return 2

       findrow (“datum”, “Datum”, “COOL”) would return DUMMY (not found)

 

       tablelookup (“datum”, “Code”, 0) would return 4001

       tablelookup (“datum”, “Code”,10000) would return DUMMY (beyond table range)

      tablelookup (“datum”, “Code,” 2) would return DUMMY (no valid data at that location)

 

  • Most of the time "tablelookup" and "findrow" are used together, for example to translate a Datum name to a code:
  •        projcode = tablelookup (“datum”, “Code”, findrow(“datum”, “Datum”, projchan));

    For more information about Table or Channel Look-ups, see the LOOKUP1 GX, LOOKUP2 GX, and the LOOKUPDBCH GX help topics.