Cron expression For alternative friday

Hi All

Lets tell tomorrow is the process first run and for the next run it sjould run in alternative fridays like
tomorrow is 15 april next run should be 29.04, 13.05 and so on

I have an alternative too like giving cron expression for all friday and give condition inside the process but i need that condition too

Can anyone help on this !!

@Nithinkrishna @ppr @supermanPunch @Yoichi



I don’t think so we can achieve using Cron expression for this schedule.

You can do one thing.

  1. Use Cron expression to schedule the job for every Friday.

  2. Add next Fridays under Holiday Calendar to skip the job run.

So for every month i need to update the holiday calender? @lakshman



Would also agree with @lakshman as the nature of Crons is not of 2 weeks intervals subsequently on a start date

another strategy could also be to put the logic into a bot scheduled each friday and calcuating if the process is to start or not. If the particular process should be started we can do it e.g. with a ORC API Call

Okay So we can’t use in cron expression , but we can get the alternative date right?
in expressions such as DateTime.Now , DayofWeek etc

@ppr @lakshman



Sorry. I didn’t get this point.

Like starting from tomorrow i need to get the alternative friday date @lakshman


I got one idea for this scenario. Let’s check whether it will work not.

  1. Create one Boolean asset in Orchestrator and set value as True Initially.

  2. At starting point you need to check this Asset value. If it is True then run the process and at the end set the Asset value as False. If it is False then don’t run the process but set Asset value True.

In this way, you can the bot every alternative Friday. But please make sure you schedule the Bot on every Friday only.

Hi @Sudharsan_Ka ,

If you want to get all the Alternative Friday Dates, Check the Below Steps :

  1. Get All the Fridays from Current Date to the End of year Date, we use the below Expression :
FridayArray = Enumerable.Range(0,(new DateTime(Now.Year,12,31)).DayOfYear-Now.DayOfYear).Select(Function(x)Now.AddDays(x)).Where(Function(y)y.DayOfWeek=5).ToArray

where FridayArray is a variable of Array of DateTime Type

  1. Next, we retrieve all Alternate Friday Dates from the FridayArray :
FridayArray = FridayArray.Where(Function(x,i)Not(Cint((i+1) mod 2)=0)).ToArray

The resultant array should contain Alternate Friday dates until the end of the year.

Let us know if it doesn’t work.

1 Like

I would probably just do a non working day calender and click out every other friday should be quick.

another simple way would be like this:

runDate would be changed to now

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