cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2703
Views
12
Helpful
8
Replies

UCCX 8 - Different prompts for different dates

lohjintiam
Enthusiast
Enthusiast

Hi all,

Is there a structured way to play different prompts based on the different dates extracted from the holiday xml file? For example each/several date(s) [01/01/2011, 02/02/2011] would correspond to a particular prompt [1.wav] while other dates have their own prompts.

Thanks!

-JT-

8 Replies 8

Anthony Holloway
Cisco Employee
Cisco Employee

I'd like to see your XML document.

Here's an example, not knowning anything about your data structure, or prompt repository:

Say your XML values looked like this:

02/14/2011

When you search for it with the Get XML Document Data step, the value returned will be the String:

"02/14/2011"

You could then easily convert the slashes to underscores, and prepend a directory on it for a valid prompt file name:

Play Prompt(--Triggering Contact--, "holidays/prompt_" + my_date.replace("/", "_") + ".wav")

That would play the prompt:

Prompts/user/{language}/holidays/prompt_02_14_2011.wav

Hi Anthony,

Thanks for your suggestion.

I'm planning to use the standard Holidays.xml (uploaded in doc mngt) file and script which has the holidayID in it and return the holidayID value as well. So holidayID [1,2,3,4] returned would be playing prompt [a.wav] while holidayID [5,6,7] would be playing prompt [b.wav] and so on.

<HOLIDAY ID='1'>DD/MM/YYYYHOLIDAY>

There's several thread talking about some changes required for this script to be used in UCCX 8 pertaining to java function and repository. Not too sure how this would impact.

Thanks!

-JT-

Then you could just put the prompt letter in an XML node attribute:

     02/14/2011

     04/27/2011

     05/30/2011

As far as your solution not being supported in UCCX 8x, just make sure you are not reading and writing to the local C:\ of the UCCX server now.  If you are, convert your scripts to start reading and writing to the repository instead.  other than that, you should be fine.

You might also consider putting the relevant information along with the holiday using a separator, this of course would require a rewrite of anything fetching xml data but it works well and is simple to implement.

12/25/2011;xmas.wav

1/1/2012;newyear.wav

As you are fetching the dates from the xml list, simply split the string based on the semi-colon into a string array, [0] will be your holiday string, [1] will be the wav.

String [] * strArray = New String [2]

strArray = resultFromXMLFetchStep.split(";")

if (strArray[0] == strOfTodaysDate)

   Play Prompt (P[strArray[1]])

   ...

It should require only a few minor changes to your script without adding much complexity and one benefit to this approach is you do not need to alter your xml query paths, which simplifies some aspects in the script writing process.  That being said, I do prefer the format proposed by Anthony as I find it visually "neater", but either will work. Whichever approach you choose, make sure you are comfortable writing the relevant code.

Apologies if the syntax I provided is wrong or incorrect, I'm typing from memory, but it should be fairly close.

Tanner Ezell

Tanner Ezell www.ctilogic.com

FYI to the readers:  Tanner's method, though valid, and creative, requires the use of method calls, which will not work in Standard.

Additionally, that is bordering on abusing the XML standard.  The whole point of XML is to mark up your data in a meaningful way.  Just be careful. 

The example Holiday script does things the hard way. There's no need to iterate through a list and do complex parsing if you structure the XML file a bit differently, putting the date in an XML tag you can search for. I wrote a generic State Manager toolkit a few years ago that manages day of week scheduling, holidays (with fractional holidays) and one-off closures or schedule operations, can tweak behaviors based on date, etc. It uses exactly this method. It actually runs on Standard as long as the XML file is strictly correctly formatted.

A very simple version of what you want might look like this:


  Thanksgiving
  Thanksgiving
  Christmas
  Christmas
  Christmas

  NewYears

  NewYears

Script steps:

1) Get the date, capture D[now] to a static variable, call it RightNow. Could reference D[now] directly the whole time but I was always paranoid about scripts running over midnight boundaries.

2) Build a String DateString as follows: "Set DateString = RightNow.month + "/" + RightNow.dom + "/" + RightNow.year". As an aside, Date .month, .dom and .year variable fields are fully accessible without tripping the UCCX Standard licensing check.

3) Grab XML data using XPath as follows: "/SPECIALDATES/SPECIALDATE[@Date='" + DateString + "']". Store the result in a String DateResult.

4a) If DateResult == "" || DateResult == null, then today isn't a special date. The XML parser may return either for no-data result, it changed between UCCX versions.

4b) If DateResult isn't empty, you'll have the string "Thanksgiving" or similar and can toss that right into Play Prompt.

I quite like this this approach, thank you for sharing that Jas

@Anthony,

I said it was simple, not pretty and proper .

Tanner Ezell www.ctilogic.com

Hi Anthony,

 

I have the attached xml file containing the holiday list. For example, Christmas contain date 12/24/2015, 12/25/2015, 12/26/2015. And Ied Mubarak contain date 07/17/2015, 07/18/2015. How can i create the If statement in a script that check if the current date is categorized as Christmas, play prompt MerryChristmas.wav? And if the current date is categorized as Ied Mubarak, play prompt IedMubarak.wav.

 

Thanks.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: