Skip to main content

Lookup

Overview

Use the lookup transform to take in an incoming string value and compare it to a list of key-value pairs to determine which output to return. If the incoming data matches a key, the transform returns the corresponding value. If the incoming key does not match a key, the transform returns the table's optional default value.

Other Considerations
  • If the input does not match any key value within the table and no default value is provided, the transform will return an error.

Transform structure

In addition to the type and name attributes, the structure of a lookup transform involves a table entry of key-value pairs:

{
"attributes": {
"table": {
"USA": "Americas",
"FRA": "EMEA",
"AUS": "APAC",
"default": "Unknown Region"
}
},
"type": "lookup",
"name": "Lookup Transform"
}

Top-level properties (required)

  • type string (required)
    Must be set to lookup.

  • name string (required)
    The name of the transform as it will appear in the UI's dropdown menus.

  • requiresPeriodicRefresh boolean (optional)
    Whether the transform logic should be reevaluated every evening as part of the identity refresh process. Default is false.

Attributes

The lookup transform uses the following structure:

{
"type": "lookup",
"name": "Transform Name",
"attributes": {
"table": {
"key1": "value1",
"key2": "value2",
"default": "defaultValue"
}
}
}

attributes (required)

The attributes object contains the configuration for the lookup table.

Required

  • table object (required)
    A JSON object of key-value pairs. The key is the string the transform tries to match to the input, and the value is the output string the transform returns if it matches the key.

    A default key must be specified. Otherwise, an error will be returned if there are no matching values in your table. :::

Optional

  • input object (optional)
    Explicitly defines the input data passed into the transform. If not provided, the transform uses input from the source and attribute combination configured in the UI.

Examples

This transform tries to map a telephone area code to a city in Texas. If there is no area code in the four provided values, the transform will return the default value of "Unknown Area."

Transform request body:

{
"attributes": {
"table": {
"512": "Austin",
"281": "Houston",
"214": "Dallas",
"210": "San Antonio",
"default": "Unknown Area"
}
},
"type": "lookup",
"name": "Lookup Transform"
}

 

This transform extends the previous one to show how multiple key values can be mapped to the same output value. However, duplicate key values are not allowed, so this will throw an error.

Transform request body:

{
"attributes": {
"table": {
"512": "Austin",
"281": "Houston",
"713": "Houston",
"832": "Houston",
"214": "Dallas",
"210": "San Antonio"
}
},
"type": "lookup",
"name": "Test Lookup Transform"
}