Data Mapping and Env Variables

Env Variables can be used for environment variables...

  • ... e.g. an endpoint for the REST Helper, which first is set to the development endpoint and can then later be changed to the production endpoint,

  • ... to create mappings, e.g. for IDs from one system to IDs to another system,

  • ... or to save input used in multiple actions, e.g. a list of IDs.

Env Variables can be applied in Flows and Insights. They don't work in Transformations.

Custom user-created Env Variables

You can create as many Env Variables (mappings) as you wish under the menu Settings > EnvVariables. Env variables can range from:

  • String: "hallo123"

  • List: ["Frankfurt", "Muenchen", "New York"]

  • JSON object: {"Germany" : "DE", "Spain" : "ES"}

  • Nested JSON object: {"countries": {"Germany" : "DE", "Spain" : "ES"}, "states": {"California": "CA"}}

JSON objects are the most common and are the preferred format for mappings. You can use our table view for editing those mappings:

This table generates the underlying JSON object of the Env Variable, which you can see by switching to Advanced view. The Value Type can be either Text or Number and others; if it is Text, the value will be put into quotation marks, otherwise, no quotation marks are used:

  "firstName": "Example",
  "lastName": "Name",
  "age": 35

You can add new entries to the JSON object with the Add line button. When entering the key, the table checks for duplicate keys and you have to remove one of the duplicate keys in order to make any other changes or save the Env Variable:

System generated Env Variables

The below Env Variables are always available in Flows and Insights and generated by the system. They are not available on Transformations:

  • di_user_email - user email as a string ""

  • di_user_name - user email as a string "Example User"

Using Env Variables

You can use Env Variables in Flows and Insights with Jinja syntax: Simply put the Env Variable name into {{ }}, e.g.: {{ country_to_country_codes }}, this will then be dynamically replaced by the underlying Env Variable during Flow or Insight execution.

Using Mappings in Flows

In order to use the mapping as such in a Flow, you can use the following syntax to search the mapping for the given key and return the corresponding values:

{{ country_to_country_codes[dic1.country_name] }}

If dic1.country_name is Italy, the Jinja would be outputted as IT during Flow execution.

Using Mappings in Insights

To use the mapping in the same way in an Insight use the following syntax:

  1. generate_array_lookup_sql is the function name

  2. For the lookup_table parameter insert the Env Variable name

  3. For the value_column parameter insert the column name of your query, which should be used to search the mapping for the given key

Last updated