โ04-21-2021 08:23 AM
I am looking for a solution to concat all the field values from multiple row into single separated by delimited symbol โ!โ.
Input data:
[
{โRecordโ: โ1โ},
{โRecordโ: โ2โ},
{โRecordโ: โ5โ},
{โRecordโ: โ4โ},
{โRecordโ: โ6โ}
]
Expected Output:
[
{โRecordsโ: โ1!2!5!4!6โ}
]
Solved! Go to Solution.
โ04-21-2021 08:42 AM
Hi @smeitei ,
First you need to group all input documents into a single array. For that you can use the Group by N snap with the setting โGroup sizeโ seto to 0. Then use a mapper with the following expression: jsonPath($, "Records[*]").map(val => val.get("Record")).join("!")
Output:
You can also use the Aggregate snap, but this will use the default delimeter.
โ04-21-2021 08:42 AM
Hi @smeitei ,
First you need to group all input documents into a single array. For that you can use the Group by N snap with the setting โGroup sizeโ seto to 0. Then use a mapper with the following expression: jsonPath($, "Records[*]").map(val => val.get("Record")).join("!")
Output:
You can also use the Aggregate snap, but this will use the default delimeter.
โ04-22-2021 12:46 AM
@j.angelevski - Thanks for you input and it works.
โ04-21-2021 08:58 AM
Another one solution for this.
jsonPath($, "$group[*].Record").reduce((acc, curr) => acc + "!" + curr)