Hello,
I have a requirement where I have a process model that needs to be triggered on the 5th business day of every month. I've already set the Timer Event on the Start Node of my process model on a monthly recurrence, however I'm having trouble writing an expression to return the 5th business day since it varies depending on the month/year.
Example:
If the expression takes in the current date (3/25/2020), it should return 6 since March 1st was a Sunday, it doesn't count, and the 6th is the 5th business day of March.
If the expression takes in the date (4/1/2020), it should return 7 since April 4 is a Saturday, April 5 is a Sunday, and the 7th is the 5th business day of April.
Any additional help is greatly appreciated!
Discussion posts and replies are publicly visible
I've tried:
workday(date(year(ri!date), month(ri!date), 1), 4)
But it's returning incorrect values, especially when counting over weekends
Passing in 2/15/20, returns 2/6/20, which is incorrect since the 5th business day of February is 2/7/20
Following code returns the 5th business day for each month this year
a!forEach( items: 1 + enumerate(12), expression: caladddays(date(2020, fv!item, 1), 4) )
Hi Mike, Its returning you 2/6/20 because it is the 4th business day of the month. Update the days to add 5
workday(date(year(ri!date), month(ri!date), 1), 5)
PS: Index in Appian starts from 1