cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4072
Views
15
Helpful
6
Replies

Day of week and time of day xml

pdub716
Level 5
Level 5

I'm looking for a central way to manage days of week and time day in a xml document for certain scripts.

I have a group that will change out their hours around holidays on a regular basis and I find myself going into multiple scripts and adjusting the hours which is a pain.

I would love to have a central location for changing hours on the fly.

I was thinking just a xml document but does anyone have a better way to do this ?

if it is a xml document would you have a sample layout ?

1 Accepted Solution

Accepted Solutions

Something like this might work (I haven't tested this so it's more proof of concept and thinking out loud):

<?xml version="1.0" encoding="UTF-8" ?>

<Days>

<Day ID="1">

<!--Sunday-->

<OpenTime>12:00 AM</OpenTime>

<CloseTime>12:00 AM</CloseTime>

</Day>

<Day ID="2">

<!--Monday-->

<OpenTime>8:00 AM</OpenTime>

<CloseTime>5:00 PM</CloseTime>

</Day>

<Day ID="3">

<!--Tuesday-->

<OpenTime>8:00 AM</OpenTime>

<CloseTime>5:00 PM</CloseTime>

</Day>

<Day ID="4">

<!--Wednesday-->

<OpenTime>8:00 AM</OpenTime>

<CloseTime>5:00 PM</CloseTime>

</Day>

<Day ID="5">

<!--Thursday-->

<OpenTime>8:00 AM</OpenTime>

<CloseTime>5:00 PM</CloseTime>

</Day>

<Day ID="6">

<!--Friday-->

<OpenTime>8:00 AM</OpenTime>

<CloseTime>5:00 PM</CloseTime>

</Day>

<Day ID="7">

<!--Saturday-->

<OpenTime>12:00 AM</OpenTime>

<CloseTime>12:00 AM</CloseTime>

</Day>

</Days>

You can adjust your open/closed times as required.

In your script that needs to check the open/close times, you can create a string variable, dayOfWeek, then you can use the Set step to set the value to the day number of the week using D[now].dow which will return a string value 1 to 7 with 1 being Sunday, I believe.

Once you have the day of the week value, you can search your XML file for that day and pick up the open time and start time values.

You can do something like this (after creating a reference to your XML file):

openTime=Get XML Document Data (xmlReference, "//Days/Day[@ID=" + dayOfWeek + "]/OpenTime")

closeTime=Get XML Document Data (xmlReference, "//Days/Day[@ID=" + dayOfWeek + "]/CloseTime")

Instead of using the time of day step, you can use an IF step to check for the days and open/closed times.

Anthony Holloway did a great explanation of how to do this here: https://supportforums.cisco.com/discussion/11982946/uccx-9-time-day-time-ranges

This should get you started in the right direction.

I hope this helps you.

Bill

View solution in original post

6 Replies 6

Bill Mungaven
Level 1
Level 1

UCCE or UCCX?

I'll start off by saying I'm a rookie programmer and I'm sure there are better ways to do this than the way I would approach it.

I'm in a UCCE/ICM/IPIVR environment in a county government setting. Our elections department has a similar requirement where they need to manually set an election date a few times a year. As it gets closer to an election, they need to open their call center on Saturday and/or Sunday. Their hours on Saturday are different than on Sunday or they may be open on Saturday but not on Sunday. On election day, they need to stay open as longs as the polls are open.

Since I'm in a UCCE/ICM environment, I created some global user variables to set the call center open/closed status, open hour, closed hour, etc. I created an IPIVR call center administration script where they can emergency close the call center, manually open it past normal business hours, set the election date and set the Saturday open/close times and Sunday open/close times, record prompts, etc.Once the date and time parameters are set using the IPIVR script, I write the values to the appropriate global variables. Now, any IPIVR script that needs to make routing decisions regarding the elections office can read in those global variables and act accordingly.

In a UCCX environment, it should work in a similar manner only you're using an XML file to store your values instead of UCCE global variables.

Do you have separate or multiple groups who require this? Does each group need to keep track of multiple dates like a holiday script?

If you have separate groups you need to control, you can create a separate XML file for each group rather than try to manage 1 XML file with each group's parameters. This might be the easiest way to keep things organized.

You can manually update the file and upload it to the UCCX server(s) or write a UCCX script that prompts for the group number whose parameters you want to change, change the date, stopping time, AM or PM, etc. The script can write the parameters to the appropriate XML file on your UCCX server(s).

An example XML file might look something like:

<?xml version="1.0" encoding="UTF-8" ?>

<!- The Group ID could be the dialed number or application trigger number of the group being controlled ->

<Groups>

<Group ID="12345">

<Date>12/23/2016</Date>

<StopTime>12:00 PM</StopTime>

</Group>

<Group ID="45678">

<Date>12/23/2016</Date>

<StopTime>1:00 PM</StopTime>

</Group>

</Groups>

I'm sure there are much better ways to do this and I'm sure one of the more seasoned/experienced programmers can suggest better ways but based on my limited skillset, this is how I would begin.

Bill

Hi Bill.

Thanks for the information

We are UCCX.

I have groups that use the same schedule so that is why I'm trying to centralize it in a xml file, this would all be managed by me so I don't need to give them the ability to change their open and close hours.

what I'm thinking is I need a xml line entry for each day

Monday
Tuesday
Wednesday.... etc

then I need a open start time and a close stop time

I'm not sure on how to do that format

Something like this might work (I haven't tested this so it's more proof of concept and thinking out loud):

<?xml version="1.0" encoding="UTF-8" ?>

<Days>

<Day ID="1">

<!--Sunday-->

<OpenTime>12:00 AM</OpenTime>

<CloseTime>12:00 AM</CloseTime>

</Day>

<Day ID="2">

<!--Monday-->

<OpenTime>8:00 AM</OpenTime>

<CloseTime>5:00 PM</CloseTime>

</Day>

<Day ID="3">

<!--Tuesday-->

<OpenTime>8:00 AM</OpenTime>

<CloseTime>5:00 PM</CloseTime>

</Day>

<Day ID="4">

<!--Wednesday-->

<OpenTime>8:00 AM</OpenTime>

<CloseTime>5:00 PM</CloseTime>

</Day>

<Day ID="5">

<!--Thursday-->

<OpenTime>8:00 AM</OpenTime>

<CloseTime>5:00 PM</CloseTime>

</Day>

<Day ID="6">

<!--Friday-->

<OpenTime>8:00 AM</OpenTime>

<CloseTime>5:00 PM</CloseTime>

</Day>

<Day ID="7">

<!--Saturday-->

<OpenTime>12:00 AM</OpenTime>

<CloseTime>12:00 AM</CloseTime>

</Day>

</Days>

You can adjust your open/closed times as required.

In your script that needs to check the open/close times, you can create a string variable, dayOfWeek, then you can use the Set step to set the value to the day number of the week using D[now].dow which will return a string value 1 to 7 with 1 being Sunday, I believe.

Once you have the day of the week value, you can search your XML file for that day and pick up the open time and start time values.

You can do something like this (after creating a reference to your XML file):

openTime=Get XML Document Data (xmlReference, "//Days/Day[@ID=" + dayOfWeek + "]/OpenTime")

closeTime=Get XML Document Data (xmlReference, "//Days/Day[@ID=" + dayOfWeek + "]/CloseTime")

Instead of using the time of day step, you can use an IF step to check for the days and open/closed times.

Anthony Holloway did a great explanation of how to do this here: https://supportforums.cisco.com/discussion/11982946/uccx-9-time-day-time-ranges

This should get you started in the right direction.

I hope this helps you.

Bill

This is exactly what I'm looking for, thanks for the help!!!!!!!!!!!!!

Hello,

 

I know this is an old thread but I read the other forum link about using the IF for time of day checks but I am trying to tie this all together using the .XML file above.

 

If someone has completed this and can point me in the right direction that would be super.

 

This is what I have so far:

 

** XML file with days and open and close time like above (Posted by Bill)

 

** Variables **

ClosedTime string ""

OpenTime string ""

DayTimeCheck Document  DOC[DayTimeCheck.xml]

Day_Time_Check Document DOC[]

dayOfWeek string ""

current_time Time null

 

** Script **

Start

Accept

Day_Time_Check = create XML Doc (DayTimeCheck)

set dayofWeek = D[now].dow

OpenTime=Get XML Document Data (Day_Time_Check, "//Days/Day[@ID=" + dayOfWeek + "]/OpenTime")

CloseTime=Get XML Document Data (Day_Time_Check, "//Days/Day[@ID=" + dayOfWeek + "]/CloseTime")

If (current_time.after(OpenTime) && current_time.before(ClosedTime) Then

True

    Open Queue

False

   Close Queue

End

 

Hi Bill,

I think this might work in my environment. I have several different working times on different dates. For example, M-TH 7AM to 9PM then on Fri 7AM-8AM and then 9AM until 7PM then Sat 8-5 and on Sunday 1PM to 6PM.

And, if it is called on Friday between 8AM and 9AM it should be routed to a unique message unlike the rest of the closed messages. Any thoughts on how I might approach this?

Any assistance is greatly appreciated. I have it working using time and date but its a bit messy.

Thanks you in advance.