12-16-2010 11:58 AM - edited 03-16-2019 02:28 AM
Is there any way you can script time of day to open and close like on a certain (example Dec 23rd, 2010)
12-17-2010 05:20 AM
There are actually several ways to do it.
1. You can hard code it into the script using date and time references and if statements.
2. You can put the date into an XML file and be closed if the current date matches any date in the XML file.
3. You can put the date into a database, and then run an SQL query for the number of rows where the current date matches the date in the database.
My preference is #3, but it requires a premium license. The advantage is that it's the most flexible way to do it. You can literally move all the logic off to the SQL server, and then run a stored procedure that simply returns a 1 if it's a holiday, and a 0 if it isn't. Another advantage is that using this approach, you can design it such that a holiday can be as short as a minute, or as long as you wish. It doesn't have to start and stop on a midnight boundry.
I've used all 3 approaches, but #3 is always my preference.
12-17-2010 05:25 AM
Any Suggestions for Enhanced ?
12-17-2010 05:29 AM
With enhanced, you're limited to 1 or 2. As long as your holidays are following a midnight boundry, it isn't too difficult to pull off with an XML file. The UCCX scripting guide has some good example scripts on how to query and read the XML file.
Of course, there is always the option of simply adding a parameter variable of a type integer...something like ManualHoliday.
Set it to 1, and the script would have an if statement to check the value. If it's 1, it assumes it's a holiday. You'd have to manually change it, but it offers a lot of flexibility if you don't want to invest a lot of time in this.
12-17-2010 05:35 AM
Any Links or examples of what you suggested?
12-17-2010 10:22 AM
Jeremy,
Attached is a snippet from a script I did years ago. It's rather crude, but it works. I was just getting started with XML at the time I wrote it. However, it's fairly easy to understand, and it sounds like you might be getting started as well.
Also attached is the XML file that it uses. I had this on a Windows box, but if I were doing it today, I'd throw it in the document repository.
The XML file has two sections. The first tells the script how many different holiday dates are in the file. The individual holiday dates are defined afterwards. I will note that you'll need to make sure that you match the date format you're getting back on your box (i.e. 2 digit years or 4 digit years as appropriate). You may need to run a debug to figure out what you're getting.
Once you get going with this, you'll likely figure out the more elegant ways to do this, but this will get you started.
Cliff
NOTICE OF CONFIDENTIALITY:
The information contained in this email transmission is confidential information which may contain information that is legally privileged and prohibited from disclosure under applicable law or by contractual agreement. The information is intended solely for the use of the individual or entity named above.
If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on the contents of this email transmission is strictly prohibited.
If you have received this email transmission in error, please notify us immediately by telephone to arrange for the return of the original transmission to us.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide