Forum Discussion
bojanvelevski
4 years agoValued Contributor
Hey @vaidyarm,
There’s a very interesting function sl.range()
that will come in handy in cases when working with dates. The pipeline below will produce the quartals for this year while meeting the conditions you stated in your previous posts.
Check this and tell me what you think
This year quartals_2022_03_23.slp (8.4 KB)
- bojanvelevski5 years agoValued Contributor
Sorry, I missed that information.
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");
Related Content
- 10 months ago
- 3 months ago
- 11 months ago
- 3 months ago