cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Format Input Data for Lookup Transform

How to Format Input Data for Lookup Transform

Transforms are a data manipulation, standardization, and normalization tool in IdentityNow that utilize bounded logic primitive operations, and they are necessary in most implementations to ensure that identity attributes have the correct values. The lookup primitive operation is extremely useful when there is one set of values coming into IdentityNow from the authoritative source, but there is a requirement to populate a corresponding set of values in an identity attribute.

For example, there is a country attribute in the authoritative source that has three-character ISO 3166-1 alpha-3 country codes, but we need to populate an identity attribute with the country's corresponding primary locale code. 

We can build a transform like this that uses the lookup primitive operation:

{
    "name": "LocaleLookup",
    "type": "lookup",
    "attributes": {
        "table": {
            "BEL": "nl_BE",
            "BRA": "pt_BR",
            "DEU": "de_DE",
            "GBR": "en_GB",
            "JPN": "ja_JP",
            "SGP": "zh-sg",
            "USA": "en_US",
            "default": "en_US"
        }
    }
}

We apply this transform to the locale attribute on the Identity Profile > Mappings page:

lookup 1.png

We see that the transform looks up the ISO 3166-1 alpha-3 code value in the country attribute and outputs the corresponding locale value from the lookup table:

lookup 2.png

But what if the values in the authoritative source country attribute are not in a standard format?  We see below that when the country attribute values are not all in the ISO 3166-1 alpha-3 code format expected by the transform, then "en_US" (the default value) is returned for Singapore, Belgium, BE, and the United Kingdom:

lookup 3.png

To correct this, we can apply another primitive operation in our transform before the lookup primitive operation to standardize its input format.  The iso3166 primitive operation converts country names, three-character ISO 3166-1 alpha-3 country codes, two-character ISO 3166-1 alpha-2 country codes, and three-digit ISO 3166-1 numeric country codes to the desired ISO 3166-1 country code output format.  Since our lookup table values are in the ISO 3166-1 alpha-3 code format, we set the format attribute to "alpha3":

{
    "name": "LocaleLookup",
    "type": "lookup",
    "attributes": {
        "input": {
            "type": "iso3166",
            "attributes": {
                "format": "alpha3"
            }
        },
        "table": {
            "BEL": "nl_BE",
            "BRA": "pt_BR",
            "DEU": "de_DE",
            "GBR": "en_UK",
            "JPN": "ja_JP",
            "SGP": "en_SG",
            "USA": "en_US",
            "default": "en_US"
        }
    }
}

We see that now all the correct locale codes for the respective countries are populated in the locale identity attribute regardless of the country identity attribute value format:

lookup 4.png

References:

ISO_3166 country codes

lookup primitive operation

iso_3166 primitive operation

 

Version history
Revision #:
8 of 8
Last update:
‎Sep 29, 2022 12:31 PM
Updated by:
 
Contributors