Raw keys in the map function
Are you certain you are mapping the RAW key?
e.g.: function
instead of Function
?
e.g.: record
instead of Record
?
Then,
You should only need one map function:
{{ first(map(16.array; "Record.Email"; "Record.Function"; "Support")) }}
(replace the above keys with the actual raw key, not the label as shown in the output bundle)
Demo
Module Export
You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.
-
Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
-
Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.
-
Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.
JSON
{
"subflows": [
{
"flow": [
{
"id": 72,
"module": "json:ParseJSON",
"version": 1,
"parameters": {
"type": ""
},
"mapper": {
"json": "{\"Array\": [\n {\n \"Record\": {\n\"Function\": \"Support\",\n\"Email\": \"support@company.com\"\n }\n },\n {\n \"Record\": {\n\"Function\": \"Finance\",\n\"Email\": \"finance@company.com\"\n }\n }\n]}"
},
"metadata": {
"designer": {
"x": -931,
"y": -2441
},
"restore": {
"parameters": {
"type": {
"label": "Choose a data structure"
}
}
},
"parameters": [
{
"name": "type",
"type": "udt",
"label": "Data structure"
}
],
"expect": [
{
"name": "json",
"type": "text",
"label": "JSON string",
"required": true
}
]
}
},
{
"id": 73,
"module": "util:SetVariable2",
"version": 1,
"parameters": {},
"mapper": {
"name": "Support Email",
"scope": "roundtrip",
"value": "{{first(map(72.Array; \"Record.Email\"; \"Record.Function\"; \"Support\"))}}"
},
"metadata": {
"designer": {
"x": -687,
"y": -2444
},
"restore": {
"expect": {
"scope": {
"label": "One cycle"
}
}
},
"expect": [
{
"name": "name",
"type": "text",
"label": "Variable name",
"required": true
},
{
"name": "scope",
"type": "select",
"label": "Variable lifetime",
"required": true,
"validate": {
"enum": [
"roundtrip",
"execution"
]
}
},
{
"name": "value",
"type": "any",
"label": "Variable value"
}
],
"interface": [
{
"name": "Support Email",
"label": "Support Email",
"type": "any"
}
]
}
}
]
}
],
"metadata": {
"version": 1
}
}