04-17-2019 08:57 AM
Hello,
I have a requirement where my pipeline will take 2 input parameters (date type), Start_date and End_date. Based on the input date, i want to generate a list of dates as mentioned below.
For Eg : Start_date = 2019-04-01, End_date = 2019-04-05, I would want downstream output as list of documents or Array( which can be flattened using splitter) as
Start_date = 2019-04-01T00:00:00, End_date = 2019-04-01T23:59:59
Start_date = 2019-04-02T00:00:00, End_date = 2019-04-02T23:59:59
Start_date = 2019-04-03T00:00:00, End_date = 2019-04-03T23:59:59
Start_date = 2019-04-04T00:00:00, End_date = 2019-04-04T23:59:59
Start_date = 2019-04-05T00:00:00, End_date = 2019-04-05T23:59:59
If the both the parameters are null then i would want the below dates as output assuming 2019-04-17T15:50:54 is the current datetime in UTC. Basically the requirement is to take the range of last 4 days from the current date.
Start_date = 2019-04-16T15:50:55, End_date = 2019-04-17T15:50:54
Start_date = 2019-04-15T15:50:55, End_date = 2019-04-16T15:50:54
Start_date = 2019-04-14T15:50:55, End_date = 2019-04-15T15:50:54
Start_date = 2019-04-13T15:50:55, End_date = 2019-04-14T15:50:54
Thanks in advance and really appreciate any help offered.
Thanks
Aravind N
Solved! Go to Solution.
04-17-2019 10:25 AM
I’m attaching a pipeline that I think demonstrates what you’re looking for:
DateLoop_2019_04_17.slp (5.1 KB)
I used a Sequence snap to generate a document for each day and then use some of the Date arithmetic methods to build the desired values in a Mapper.
To compute the difference between the two dates, I used this expression library:
https://raw.githubusercontent.com/SnapLogic/contrib-elib/master/datetime.expr
If you use the library, you probably should download it from that link and place it in the project with the pipeline.
04-17-2019 10:25 AM
I’m attaching a pipeline that I think demonstrates what you’re looking for:
DateLoop_2019_04_17.slp (5.1 KB)
I used a Sequence snap to generate a document for each day and then use some of the Date arithmetic methods to build the desired values in a Mapper.
To compute the difference between the two dates, I used this expression library:
https://raw.githubusercontent.com/SnapLogic/contrib-elib/master/datetime.expr
If you use the library, you probably should download it from that link and place it in the project with the pipeline.
04-18-2019 08:52 AM
Thanks for the solution. It worked fine.