Liquid Studio Documentation
Data Mapping / Data Mapper Functions / By Category / Misc / Lookup
In This Topic
    In This Topic

    Function Name
    Maps one set of values to another
    Value The value to be mapped
    Result The mapped value
    None -


    The lookup component replaces one value with another, so for example you may need to change ISO 2 letter country codes into ISO 3 letter country codes, or Currency names into currency characters etc.

    The Lookup components properties (right click on the lookup component and select the 'properties' menu item), allow the key to value mappings to be configured.

    The lookup data can from static values defined when you create the transform, or they can be dynamic can come from the transform.

    Static lookup data


    Values can be added individually via the Add button or the entire mapping can be edited via the Import button (allows editing as a CSV formatted list).

    Dynamic Lookup data

    If the mapping data source is set to dynamic, then the mapping data is constructed at runtime.

    When this option is selected the 'lookup' component gets an addition set of inputs.

    For every 'Data' entry encountered a key/value pair is recorded from the first value in the 'Data/Key' and 'Data/Value' nodes.

    The 'Data' input is run once within its own context at the start of the transform in order to build the mapping data.

    Running in its own context means it will ignore any connections made to nodes higher up in the source components.
    Simply put it will run as if all the other connections in the transform have been deleted except for those connected to the 'Data', 'Data/Key' & 'Data/Value' nodes (and any components they connect recursively).


    Mapping Failures

    This section determines what happens when a key value is looked up at runtime that is not in the mapping data.

    Use key (Input) value

    The value returned for an input value that has no corresponding key value will be the input value itself.

    Use Default Value

    The value returned for an input value that has no corresponding key value will be a default value specified by in the field below.

    Raise Error

    If an input value has no corresponding key value, then a runtime error is raised and the transform stops.



    The following examples assume the following mapping data values have been set up

    Key Value
    US USA
    GB GBR
    FR FRA
    DE DEU

    Example 1

    If Mapping Failures is set to 'Use Key (input) Value'.

    Value Result
    US USA
    AU AU
    FR FRA

    Example 2

    If Mapping Failures is set to 'Use Default' and the default value is set to '???'

    Value Result
    US USA
    AU ???
    FR FRA

    Example 3

    If Mapping Failures is set to 'Raise Error'

    Value Result
    US USA
    AU Runtime Error

    The 'Key' values must be unique, and error will be raised if duplicates exist.