User`s guide
CHAPTER 6 Components
User’s Guide 105
Enter the Connection Parameters as described in “Entering database
connection parameters” on page 71.
Query
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
Specify a Default Value to assign to the value attribute, in case the key value is
not found in the lookup table.
Use Key Value
If Use Key Value is activated, the key value will be assigned to the value
attribute instead of the default, if the lookup fails.
Lookup Empty/Null Keys
If activated, the lookup is performed even for empty or NULL key values.
Otherwise the selected default method applies.