How to manage run on weekends when I am taking data from yesterday, and weekends are off

Hi, I am fetching Yesterday’s data from outlook and processing on it but I am stuck on weekends.
I need Friday’s data on Saturday’s run but not Saturday’s data on Sunday as Weekends are off.
And on Monday I don’t want to run my job as last day is Sunday and no one suppose to send email on Sunday.

Overall I want to run my job from Tuesday to Saturday.

How to manage this run, Please help.
@Palaniyappan

Are you asking for assistance in scheduling/triggering a job to run Tuesday to Friday or are you asking for assistance with the logic in the process when checking the email?

For a Cron it would similar to the following where 2 would be Tuesday and 7 is Sunday.

15 09 * * 2-7

Typically Sunday is referenced with 0 or 7. Should also be able to use short form like TUE-SUN.

!Correction! UiPath doesn’t use what I am familiar with as it has seconds as well as Sunday starts at 1 and Saturday is 7 rather than Sunday being 0 or 7. With that in mind Tuesday would be 3 and Saturday would be 7.

https://crontab.guru/#0_22_*_*_2-7

1 Like

you must be doing now.AddDays(-1) to get yesterdays date.
but if yesterday turned out to be Sunday then what? is your query

so what u can do id put if block activity and your condition would be
Now.AddDays(-1).DayOfWeek.Equals(“Sunday”) then now.AddDays(-2) this would give you Saturday’s data on Monday instead of Sunday’s

1 Like

Thanks for reply,
I have found below cron job expression for my requirement.
can you please confirm if this will work-
0 0 5 ? * TUE,WED,THU,FRI,SAT *

Note- I want to run from Tue to Sat only.

I like your solution in case I want to send only on Weekdays.
Lets see if cron job expression won’t work I will apply your suggestion.

1 Like

Yes, that would be accepted and interpreted as “At 05:00 AM, only on Tuesday, Wednesday, Thursday, Friday, and Saturday”. When you enter in your Advanced/Cron expression, it validates it and will produce an error if it is not valid.

To shorten the expression you could use 0 0 5 ? * TUE-SAT which give you the same outcome but read as “At 05:00:00 AM, Tuesday through Saturday”.

┌─────────────seconds  (0 - 59)
│ ┌───────────── minute (0 - 59)
│ │ ┌───────────── hour (0 - 23)
│ │ │ ┌───────────── day of the month (1 - 31)
│ │ │ │ ┌───────────── month (1 - 12 or JAN - DEC)
│ │ │ │ │ ┌───────────── day of the week (1 - 7 or SUN - SAT)
│ │ │ │ │ │ ┌───────────── year (1970 - 2099 or blank)                 
│ │ │ │ │ │ │
│ │ │ │ │ │ │
* * * * * * *

Alternatively, what you are looking for does not require the Advanced option you can simple select Weekly with your specific days.

image`

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.