cancel
Showing results for 
Search instead for 
Did you mean: 

Scheduled Task End DateTime

leonardoamorim
New Contributor

Hi,

I have a pipeline that is supposed to run on a daily basis and I’m struggling in writing the logic for a timeframe.

Basically, I have a API picking up data from Workday and we have two parameters (“to” and “from”) as following:
image

The problem is when I was reading the documentation, it says the the task.end result is an arbitrary date far in the future if I initiate the Task in designer.

What I want to do is:

  1. First run this pipeline with the ‘to’ date being today and ‘from’ date being yesterday (so, -1 day
  2. From this, schedule the task to run daily and now instead of passing the ‘from’ date of -1 day I want it to get the end time of the first execution.

Example:

  1. I run today manually at 31/05/2022 at 18:00pm
  2. The task ends at 31/05/2022 at 18:30pm
  3. Create the schedule task to run day to day, so starting at 01/06/2022 to run FROM 18:30 (task end of point 2) TO todays date (01/06/2022 18:00pm)

Can someone help me with this?

Thank you so much! 🙂

2 REPLIES 2

Supratim
Contributor III

@leonardoamorim you can use a file write and save you task end time in sldb. and next time you will read data from that file and use your from day from there. Your pipeline might be looks like below pic. You create a json file with from date, then upload in first file reader snap. After calling WD API you finish all your business logic then add mapper to set from date for next run and write as json file. Make sure your file reader and file write file name should be same (basically it should override old value always) and name of from date attribute should be same as in set from date mapper and used in WD API. I would prefer Date.now() to set from date rather task.end ,as you use to date as Date.now().

image

leonardoamorim
New Contributor

@Supratim works perfectly! Thank you so much!