To open the Query window, click Query and enter the query for the lookup.
The Lookup is made of a SELECT query returning a single value that corresponds with the Value Attribute.
The query required in the DB Lookup Dynamic component is slightly different from the one used in the DB Lookup component. The query will return exactly one single value, which is the value found for the corresponding Key Attribute. The value of the Key Attribute is represented in a predefined variable named LOOKUP, which is used as a placeholder in the WHERE clause of the query. The notation for this placeholder is an SBN expression.
The basic structure of the query for the DB Lookup Dynamic component is:
SELECT <value attribute> FROM <lookup table> WHERE <key attribute> = '[LOOKUP]'
During execution of the query, the LOOKUP will be replaced
by the current value of the Key Attribute of the current record
and the SBN will be evaluated. If the Key Attribute is a character
datatype, use quotes: '[LOOKUP]'
.
You can use functions to apply formatting or calculations:
SELECT DESTINATION FROM LOOKUP_PRODUCTS WHERE SOURCE = '[uRTrim(LOOKUP)]' Optional Properties Default Value