Skip to main content Skip to complementary content

LookUp - script function

Lookup() looks into a table that is already loaded and returns the value of field_name corresponding to the first occurrence of the value match_field_value in the field match_field_name. The table can be the current table or another table previously loaded.

Syntax:  

lookup(field_name, match_field_name, match_field_value [, table_name])

Return data type: dual

Arguments:  

Argument Description
field_name Name of the field for which the return value is required.Input value must be given as a string (for example, quoted literals).
match_field_name Name of the field to look up match_field_value in. Input value must be given as a string (for example, quoted literals).
match_field_value Value to look up in match_field_name field.
table_name

Name of the table in which to look up the value. Input value must be given as a string (for example quoted literals).

If table_name is omitted the current table is assumed.

Information noteArguments without quotes refer to the current table. To refer to other tables, enclose an argument in single quotes.

Limitations:  

The order in which the search is made is the load order, unless the table is the result of complex operations such as joins, in which case, the order is not well defined. Both field_name and match_field_name must be fields in the same table, specified by table_name.

If no match is found, NULL is returned.

Information noteThe Lookup() function is flexible and can access any previously loaded table. However, it is slow compared with the Applymap() function.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!