Use this script, it groups all inputs into single array:
execute : function () {
this.log.info("Executing Transform Script");
var groupByN = new ArrayList();
var wrapper = {};
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.
var inDoc = this.input.next();
groupByN.add(inDoc);
wrapper = {"Data": groupByN};
}
catch (err) {
var errDoc = new LinkedHashMap();
errDoc.put("error", err);
this.log.error(err);
this.error.write(errDoc);
}
}
this.output.write(wrapper);
this.log.info("Script executed");
}
I tested it with ultra task and it seems it works.