Jump to content

#8: Today I will stay in bed!


Tom Wellige

688 views

 Share


VBScript Lua

 

Days on which you can stay in bed in the morning are usually weekends, vacations or public/bank holidays. 

 

While you can plan your call routing for weekends and vacations quite easily, as they have fixed/planned dates, things get a little bit more difficult with public/bank holidays. There are of course public/bank holidays with fixed dates, like "Labor day (01.05.)" or "Day of German reunification (03.10.)" or "Christmas (25.12./26.12.)", but there are also "moving" public/bank holidays, the church holidays. These holidays are all tight to Easter, either at a fixed distance before or after it (Good Friday, Pentecost, etc.). Problem is, Easter is every year on a different date. I spare you the history behind this,  lets just accept it as it is.

 

So, to solve the problem of public/bank/church holidays from a call routing perspective many people (incl. me) came up with simple solutions, all based on prepared lists of such holidays (in text files or databases). My solution to this problem for example is still available in the Swyx Knowledgebase.

 

All these attempts with prepared lists of public/bank/church holidays all share the same problem: these lists have an end. Regardless for how many years you put these dates in advance into the list, if the final date is reached and you forgot about this list, your call routing will not know about holidays. I saw many cases where this happened, where after a couple of years it was forgotten to maintain the holidays list.

 

In comes the solution for this problem: calculate the moving church holidays. Do it exactly like it is done in reality. In 1800 Carl Friedrich Gauss published his "Easter algorithm" to calculate the Julian or Gregorian Easter. If you want to learn how this algorithm works, just follow the previous link. 

 

 

For VBScript based Call Routing:

 

In 2014 the forum user JoergG glued the Gauss algorithm into VBScript along with a framework to check for any holiday (fixed or moving) in any of the German federal states. And he was very kind to offer this function to the community! In 2018 the forum user kroni99 adapted this function for Austria. Both these functions are of course available here on Swyx Forum:
 

 

If you have adapted the "IsPublicHoliday" function for another country it would be quite nice of you if you would share it with the community. Either post it yourself of just get in touch with me.

 

So, if you need to know in your call routing if today is a public holiday you can directly call this function from within an "Evaluate" block:

 

image.png

 

image.png

 

 

 

 

The entire usage instructions for the "IsPublicHoliday" function are given in the above stated links to the functions for Austria and Germany. so I will save you from all the details here. 

 

It can't get any more easy: you setup this call routing (which is not more than a little bit of Copy&Paste, according to the linked instructions) and then you can forget about the public/bank/church holidays again. You don't need to update your call routing anymore in a couple of years.

 

 

For Lua based Call Routing:

 

For Lua based Call Routing the SwyxWare comes already with a build-in function IsHolidayInGermany(). Unlike the two above mentioned VBScript functions, this function comes with a slightly improved Gauss formula by Heinrich Lichtenberg.

 

The usage is more or less the same. So, if you need to know in your call routing if today is a public holiday you can directly call this function from within an "Evaluate" block:

 

image.png

 

image.png

 

As Lua supports optional parameters, it is possible to omit the second parameter. By doing so, the current date will be checked. If you want to check another date, just pass it as second parameter.

 

For complete usage instructions of this functions, just follow the above given link.

 

It can't get any more easy: just use the included function and then you can forget about the public/bank/church holidays again. You don't need to update your call routing anymore in a couple of years.

 

 

Of course you shouldn't forget about them if you want to stay in bed a little bit longer ;) 

 

 

Enjoy!

 

PS: don't miss to take a look into the ECR Useful Link Collection

 

 Share


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.