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