Lookup Mapping


The Lookup Mapping node establishes the mapping relationship between the key in the input msg and the key in the mapping file, and output the specified mapping data to msg.


To aggregate multiple values, the CSV file must have a column with dataType header name and you must specify one key in the input msg as the aggregate key. After mapping successfully, the values of the key will be aggregated to arrays and output to msg if the values are in array type and have the same generics, which the values of the not-specified keys will not be output.


Note

The node is only for querying the mapping relationship. The structuring of the subsequent standard device measurement points would require other nodes such as Template.

Node Type


EnOS.

Input and Output Ability


This node has 1 entry point and 1 exit point. Both the input and output are JSON.

Node Properties


../../_images/lookup_mapping.png


Name

The name for this node.


Mapping File

Upload the CSV mapping file that includes the keys to be mapped in the input msg and others. You can click the Download Template icon template to download a template to use, click the Upload icon upload to upload the file, or click the Download icon download to download the file that has been uploaded.


Mapping Results

Choose one or more keys from the list of column headers, taken from the mapping file, to set as the output after mapping.


The CSV file must have a column with dataType header name if the aggregation of multiple values is required. Available dataType values are as per the below.

  • number: numeric
  • string: text
  • array<number>: numeric array
  • array<string>: string array
  • boolean

After mapping successfully, the values of the Mapping Value will be aggregated to an array and output if they:

  • have the same mapping type,
  • and the dataType is array and the generics is the same.

See Sample 3 as an example.


Mapping Key

Choose from the list of column headers, taken from the mapping file, to set as the mapping key. You can choose more than one.


Mapping Value

Specify a key from the input msg using expression, for example ${msg.key}.

After mapping successfully, the values of the key will be aggregated to arrays and output to msg if the values are in array type and have the same generics, which the values of the not-specified keys will not be output. See Sample 5 as an example.

If blank, all the values of the key in the input msg will be output (see Sample 1).


Description

The description for this node.

Limitations

  • Maximum number of records in mapping file: 150,000
  • Maximum mapping file size: 16M
  • Currently can only upload CSV files as the mapping file.
  • Can only specify 1 value for Mapping Value.
  • An integration flow cannot have more than 5 Lookup Mapping nodes.

Samples

The samples below are based on a CSV file with the following data.

Key1 Key2 Key3 dataType
AI000001 1KaobBq4I AO-BOOL-ARRAY array<string>
AI000001 2KaobBq4I AO-BOOL-STRING string
AI000001 3KaobBq4I AO-BOOL-STRING2 string
AI000001 4KaobBq4I AO-BOOL-ARRAY array<string>
AI000002 1KaobBq4I AO-BOOL-ARRAY array<string>
AI000002 6KaobBq4I AO-BOOL-STRING string
AI000003 7KaobBq4I AO-BOOL-ARRAY array<string>
AI000004 8KaobBq4I AO-BOOL-FLOAT number

Input and Output Samples

Sample 2

Mapping Results: Key3

Mapping Key: Key1, Key2

Input
[
  {
    "Key1": "AI000004", //Key1 and Key2 are the mapping keys
    "Key2": "8KaobBq4I",
    "value": "77"
  }
]
Output
[
  {
    "Key1": "AI000004",
    "Key2": "8KaobBq4I",
    "value": "77",
    "Key3": "AO-BOOL-FLOAT"
  }
]

Sample 4

Mapping Results: Key2, Key3

Mapping Key: Key1

Input
[
  {
    "Key1": "AI000001",
    "value": "18"
  }
]
Output
[
  {
    "Key2": "1KaobBq4I",
    "Key1": "AI000001",
    "value": "18",
    "Key3": "AO-BOOL-ARRAY"
  },
  {
    "Key2": "2KaobBq4I",
    "Key1": "AI000001",
    "value": "18",
    "Key3": "AO-BOOL-STRING"
  },
  {
    "Key2": "3KaobBq4I",
    "Key1": "AI000001",
    "value": "18",
    "Key3": "AO-BOOL-STRING2"
  },
  {
    "Key2": "4KaobBq4I",
    "Key1": "AI000001",
    "value": "18",
    "Key3": "AO-BOOL-ARRAY"
  }
]