-
Notifications
You must be signed in to change notification settings - Fork 1
Lookup Operator
Lookups must be defined in the LookupMaps described in Config File Documentation. After that, the name of the lookup map can be used as an operator which returns a string value.
What | Type |
---|---|
Syntax |
[LookupName](key, $lookupField) , [LookupName] is defined with the name of the <LookupMap> tag (see Config File Documentation) |
key |
string |
$lookupField |
Field Operator ($[field name] ) |
Return type | string |
If the noFailOnMiss
attribute is not set to true
in the configuration of the lookup map, a map "miss" will result in a cancelled processing by NFT. If noFailOnMiss
is set to true
, a lookup miss will yield an empty string as return value.
If the lookupField
is not present in the source of the lookup map, an error will be thrown and the transformation processed is cancelled.
Example:
<LookupMaps>
<LookupMap keyField="id" name="StatusLookup">
<Source config="delim=','">file://C:\Temp\status_mapping.csv</Source>
</LookupMap>
</LookupMaps>
Pro tip: Nested lookups are also allowed. Typical use cases would be string to string mappings, where the source field and desired outcome may not be strings, but rather indexes. Example:
<Field name="Status">TargetStatus(SourceStatus($StatusId, $StatusText), $TargetText)</Field>
This expression first looks up a StatusText
from the SourceStatus
lookup map, then maps that text using the TargetStatus
lookup map, and subsequently outputs the TargetText
of that map into a target field called Status
. The transformation is thus
the following:
Source.StatusId --> SourceStatus.StatusText --> TargetStatus.TargetText --> Target.Status