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.

Note: Arguments 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.

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

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?