CSVMap¶
Maps the input string to a value looked up in an external CSV file by source-column key.
CSVMap looks up the input value in a CSV file registered with the
engine, using sourceColumn as the lookup key, and returns the value
from destinationColumn of the matching row. CSV files are loaded
through the engine's csvmap directory configuration.
CSV columns are stored as strings, so the input must be STRING-typed
— use AsString() upstream for numeric or date inputs. When the lookup
fails:
- With a fourth (default) parameter, the default value is returned and
successfulMappingis set tofalse. - Without a default, the row is marked unsuccessful so that conditional
chaining (
||) can fall through to a fallback rule.
CSVMap supports multi-sized results: [] returns every matching row,
[N] requires exactly N. With multiple matches, all values are
emitted as additional results.
Parameters¶
- 1 —
fileMandatory — accepts: STRING -
Name of the CSV file relative to the directory pointed to by the
csvmap directoryclause inetl.conf. - 2 —
sourceColumnMandatory — accepts: STRING -
Header name of the column to look up the input value against.
- 3 —
destinationColumnMandatory — accepts: STRING -
Header name of the column whose value is returned on match.
- 4 —
defaultOptional — accepts: STRING, NULL -
Default value used when no match is found. Without this parameter, unmatched rows are marked unsuccessful so that
||-chains can take over.
Input type¶
STRING
Output type¶
STRING
Requires¶
- The CSV file must be registered under the configured
csvmap directory. - Allows multi-sized results.
Examples¶
Single-result lookup with default (test064)
Multi-result lookup, unlimited
Conditional chaining onto a Map fallback
CSVMap("multi_lookup.csv", "member_id", "member_name") ||
Map([["This", "is"], ["not", "used"]], "MISSING")
Errors¶
-
CSVMap cannot handle a null value as input- A
NULLreached the rule and no default value is configured.
-
The fileX' doesn't exist in the csvmap directory`- The CSV file is missing or not registered with the engine.
-
CSVMap requires STRING input- A non-
STRINGinput field was used. Convert withAsString()first.
-
CSVMap accepts three to four parameters- Wrong arity or non-string parameter type.