Holiday Count

  • 21 November 2019
  • 6 replies
  • 0 views

Badge +2

I am trying to develop a workflow to count holidays.  Have the idea to format date , "MMdd" excluding the year.  I want it to loop using create date incrementing by 1 until it equals SentDate.  I was thinking of using a switch or run if as I need 1224 (christmas eve to add .5) and 1225 (christmas Day to add 1).  
What I envisioned is it looping until create date = sent date and each time the incrementd date would get formatted to MMdd and checked and either add .5 for half day or 1 for full day off.  Excluding the year would allow it to run indefinatly.

The set Holiday = to sum of all between create date and sent date.
Any help is greatly appreciated.  This is my first loop.  

Thank you.


6 replies

Userlevel 3
Badge +9
How about just use the Query List action to do the totaling on a Holiday list that has 2 columns: YearMonthDay as Number, MorningAfternoon as single line of text

Holiday would look like something like this:
YearMonthDay MorningAfternoon
190101 AM
190101 PM
190121 AM
190121 PM
190527 AM
190527 PM
190704 AM
190704 PM
190902 AM
190902 PM
191111 AM
191111 PM
191128 AM
191128 PM
191224 PM <-- notice this is just a half day
191225 AM
191225 PM
191231 PM <-- this is just a half day too
200101 AM
200101 PM
...

So the parameters to Query List action would be:
list=Holiday
Filter=Select items only when the following is true
Show the items when column: YearMonthDay is greater than or equal to CreateDate
AND when column YearMonthDay is lessthan or equal to SentDate
Result count=numHalfdayHolidays

Then do the action "Do Calculation":
numHalfdayHolidays divide by 2 is assigned to numHolidays

Now the variable numHolidays will be the sum of half day holidays divided by 2

Since the time of some holidays vary from year to year AND the CreateDate SentDate range may span the year end, I inserted the year infront.
Userlevel 6
Badge +22

Hi,

I created a workflow (attached) based on your idea where I have a switch with the holidays and if that holiday comes up it goes down the branch and adds a day to the holiday count variable.

Holidays I used are based on:

https://www.business.vic.gov.au/victorian-public-holidays-and-daylight-saving/victorian-public-holidays

Any questions let me know,

Badge +2
I downloaded the workflow and am trying to get it to work. I changed the start date and end date from a date to start date = created and end date = sent which is a date column. It continues to say in progress and is not completing. Do I need to format the dates before datediff is calculated? or do you have an idea as to what I might be doing wrong?
Userlevel 6
Badge +22
If you run the workflow as is does it work for you?
There is no formatting required. As long as the start date is before the end date it should work.
Badge +2

Both responses worked.  Wanted to select both as an accepted solution.  Thank you both for your responses.

Userlevel 6
Badge +22
You can give me Kudos instead :P

Reply