ContributionsMost RecentMost LikesSolutionsRe: Merge multiple documents to an array in ultra pipeline bojanvelevski: Hello Bojan Thank you for your time and help. We did validate the script in ultra task and saw the same behavior like earlier. We will test the other approach using Formatter snap and let you know. Thank you again Re: Merge multiple documents to an array in ultra pipeline the data coming from DB2 Re: Merge multiple documents to an array in ultra pipeline a SQL snap gets the data from tables Re: Merge multiple documents to an array in ultra pipeline 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 Re: Merge multiple documents to an array in ultra pipeline not really, that is the challenge we are running into…looking to get the millisecond response from api using ultra task Re: Merge multiple documents to an array in ultra pipeline yes. this will work but we dont want to call child as it is a ultra task and wanted to have ms response time Re: Merge multiple documents to an array in ultra pipeline We tried with script as below. it works in design mode but not when we call ultra tasks. When we call ultra tasks the script snap doesnt provide any output execute : function () { this.log.info(“Executing Transform Script”); var outDoc = new LinkedHashMap(); var inDoc=null; var items = new ArrayList(); var i=0; while (this.input.hasNext()) { try { // Read the next input document, store it a new LinkedHashMap, and write this as an output document. // We must use a serializable Java type liked LinkedHashMap for each output instead of a native // JavaScript object so that downstream Snaps like Copy can process it correctly. inDoc = this.input.next(); i=i+1; items.add(inDoc); outDoc.put("index", i); if ((!this.input.hasNext()) || (this.input.hasNext()==false)) { outDoc.put("data", items); this.output.write(inDoc, outDoc); } } catch (err) { var errDoc = new LinkedHashMap(); errDoc.put("error", err); this.log.error(err); this.error.write(errDoc); } } this.log.info("Script executed"); Re: Merge multiple documents to an array in ultra pipeline yes, but Group by is not supported in Ultra tasks Merge multiple documents to an array in ultra pipeline 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”}] ] Re: Merge documents into one big document Can one of you let me know if there was a solution for this?