I set a variable to extract each ID from each array in each bundle before I aggregate the original set of bundles. Then use the map() to extract the IDs from the various __IMTKEY___
names. Finally I use flatten() which converts multiple arrays into 1. This will allow multiple set of IDs for each original bundle if that is a possibility.
View Scenario JSON Blueprint
{
"subflows": [
{
"flow": [
{
"id": 3,
"module": "json:ParseJSON",
"version": 1,
"parameters": {
"type": ""
},
"mapper": {
"json": "[\n {\n \"__IMTKEY__\": \"Preference\",\n \"array\": [\n {\n \"id\": \"32b5edf9-b8a6-426e-b860-7e7116dd2b10\"\n },\n {\n \"id\": \"32b5edf9-b8a6-426e-b860-7e7116dd2b11\"\n }\n ]\n },\n {\n \"__IMTKEY__\": \"Sick\",\n \"array\": [\n {\n \"id\": \"32b5edf9-b8a6-426e-b860-7e7116dd2c13\"\n }\n ]\n },\n {\n \"__IMTKEY__\": \"Holiday\",\n \"array\": [\n {\n \"id\": \"c41f69ae-e542-4095-934d-04511699aaad\"\n }\n ]\n }\n]"
},
"metadata": {
"designer": {
"x": 0,
"y": 0
},
"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": 18,
"module": "util:SetVariable2",
"version": 1,
"parameters": {},
"mapper": {
"name": "id",
"scope": "roundtrip",
"value": "{{map(3.array; \"id\")}}"
},
"metadata": {
"designer": {
"x": 300,
"y": 0
},
"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": "id",
"label": "id",
"type": "any"
}
]
}
},
{
"id": 17,
"module": "builtin:BasicAggregator",
"version": 1,
"parameters": {
"feeder": 3
},
"mapper": {
"id": "{{18.id}}",
"__IMTKEY__": "{{3.`__IMTKEY__`}}"
},
"metadata": {
"designer": {
"x": 600,
"y": 0
},
"restore": {
"extra": {
"feeder": {
"label": "JSON - Parse JSON [3]"
},
"target": {
"label": "Custom"
}
}
}
}
},
{
"id": 19,
"module": "util:SetVariables",
"version": 1,
"parameters": {},
"mapper": {
"variables": [
{
"name": "Unavailable",
"value": "{{flatten(map(17.array; \"id\"; \"__IMTKEY__\"; \"Sick,Holiday\"))}}"
},
{
"name": "Preference",
"value": "{{flatten(map(17.array; \"id\"; \"__IMTKEY__\"; \"Preference\"))}}"
}
],
"scope": "roundtrip"
},
"metadata": {
"designer": {
"x": 900,
"y": 0
},
"restore": {
"expect": {
"variables": {
"items": [
null,
null
]
},
"scope": {
"label": "One cycle"
}
}
},
"expect": [
{
"name": "variables",
"type": "array",
"label": "Variables",
"spec": [
{
"name": "name",
"label": "Variable name",
"type": "text",
"required": true
},
{
"name": "value",
"label": "Variable value",
"type": "any"
}
]
},
{
"name": "scope",
"type": "select",
"label": "Variable lifetime",
"required": true,
"validate": {
"enum": [
"roundtrip",
"execution"
]
}
}
],
"interface": [
{
"name": "Unavailable",
"label": "Unavailable",
"type": "any"
},
{
"name": "Preference",
"label": "Preference",
"type": "any"
}
]
}
}
]
}
],
"metadata": {
"version": 1
}
}