I’m trying to amalgamate two JSON data sets in a flow. I have outlined below an example of what I need to achieve.
Data set 1 (clients)
[
{
“Id”: “ABCD”,
“Department”: “C1000”,
“status”: “Active”
},
{
“Id”: “BCDE”,
“Department”: “C2000”,
“status”: “Active”
},
{
“Id”: “CDEF”,
“Department”: “C4000”,
“status”: “Active”
}
]
Data set 2 (Jobs)
[
{
“jobclient”: “BCDE”,
“jobdept”: “C6000”,
“key”: “12345”
},
{
“jobclient”: “BCDE”,
“jobdept”: “C6000”,
“key”: “14765”
},
{
“jobclient”: “ABCD”,
“jobdept”: “C6000”,
“key”: “1275”
},
{
“jobclient”: “CDEF”,
“jobdept”: “C6000”,
“key”: “2345”
},
{
“jobclient”: “BCDE”,
“jobdept”: “C6000”,
“key”: “182245”
}
]
Required output would be a ….
[
{
“Id”: “ABCD”,
“Department”: “C1000”,
“status”: “Active”,
“jobclient”: “ABCD”,
“jobdept”: “C6000”,
“key”: “1275”
},
{
“Id”: “BCDE”,
“Department”: “C2000”,
“status”: “Active”,
“jobclient”: “BCDE”,
“jobdept”: “C6000”,
“key”: “12345”
},
{
“Id”: “BCDE”,
“Department”: “C2000”,
“status”: “Active”,
“jobclient”: “BCDE”,
“jobdept”: “C6000”,
“key”: “14765”
},
{
“Id”: “BCDE”,
“Department”: “C2000”,
“status”: “Active”,
“jobclient”: “BCDE”,
“jobdept”: “C6000”,
“key”: “182245”
},
{
“Id”: “CDEF”,
“Department”: “C4000”,
“status”: “Active”,
“jobclient”: “CDEF”,
“jobdept”: “C6000”,
“key”: “2345”
}
]
The output needs to run through the client dataset and create a record for each time it finds a match in the jobs dataset.
I’m sure it will require an “Evaluate” block and use the $map function but I have no idea how to write it. Can anyone help?