cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Merge multiple documents to an array in ultra pipeline

thilkip
New Contributor

We need to merge multiple documents to single array and looking for help. Since it is ultra task, we are running out of optionsโ€ฆ

Input data:

[
{โ€œRecordโ€: โ€œ1โ€},
{โ€œRecordโ€: โ€œ2โ€},
{โ€œRecordโ€: โ€œ5โ€},
{โ€œRecordโ€: โ€œ4โ€},
{โ€œRecordโ€: โ€œ6โ€}
]

Expected Output:
[ โ€œresponseโ€: [{โ€œRecordโ€: โ€œ1โ€}, {โ€œRecordโ€: โ€œ2โ€}, {โ€œRecordโ€: โ€œ5โ€}, {โ€œRecordโ€: โ€œ4โ€}, {โ€œRecordโ€: โ€œ6โ€}]
]

25 REPLIES 25

Thanks. but please see below, 40 documents went in and 0 out. if we put the write inside the while loop, it will write 40 documents in this case but we need the 40th document as the final result. if there is a way to take the last document, that will also help

image

koryknick
Employee
Employee

@thilkip - what is generating the input documents?

a SQL snap gets the data from tables

koryknick
Employee
Employee

SQL Server 2016 (13.x) and later has a โ€œFOR JSONโ€ clause:

You should be able to return the result set exactly how you want.

the data coming from DB2