Lookup Mapping


The Lookup Mapping node finds the mapping relationship as per the given CSV 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 where data in the input msg will be displayed in the output msg according to the specified dataType in the CSV if mapping is successful.

Note

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

Node Type

IoT Hub.

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 here. 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 from the list of column headers, taken from the mapping file, to set as the output after mapping. You can choose more than one.

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


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

By default, data in the input msg will be output to the output msg according to the dataType if mapping is successful (see Sample 1). To output a particular data, specify it using expression, for example ${msg.value} (see Sample 5). Data not specified will not be in the output msg.


Description

The description for this node.

Limitations

  • Maximum number of records in mapping file: 50,000

  • Maximum mapping file size: 2M

  • Currently can only upload CSV files as the mapping file.

  • Can only specify 1 value for Mapping Value.

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 3

Mapping Results: Key2, Key3

Mapping Key: Key1

Mapping Value: ${msg.value}

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

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"
  }
]