DBLOOKUP

Description

Searches a column of a database table for a value and returns the corresponding value from another column in the same row.

Syntax

DBLOOKUP ( TextSourceField, "connection", "table", "lookup_field", "substitution_field" )

Parameter Description
TextSourceField The value for which to search in the lookup_field column.
connection The connection where this lookup table resides.

If the connection is Scribe Internal Database, the SCRIBE user must have at least SELECT privileges on the lookup table.
table The name of the lookup table.
lookup_field The name of the column in the lookup table that stores the value to search for.
substitution_field The name of the column in the lookup table that stores the value to return.

Remarks

Note: This function requires special handling when working with bulk operations. See Using Bulk Operations for more information.

Useful for substituting full values for codes or vice versa.

To optimize performance, if DBLOOKUP is called again with the same parameters, it returns the same result (without performing another lookup).

Examples

The following example uses this table named TITLE_CODE in a target database, which has the connection name of Target.

Code Value
1 Owner
2 President
3 Manager
4 Executive Director
5 Principal

This function returns "Manager":

DBLOOKUP("3", "Target", "TITLE_CODE", "Code", "Value")

See also

FKEYSUBST

DBLOOKUP2

DBLOOKUPCached

FILELOOKUP