cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
773
Views
5
Helpful
4
Replies

Curious - Anyone still using the original HolidayCheck.aef script?

Sean Lynch
Level 7
Level 7

I'm just curious if anyone is still using the original CheckHoliday.aef script for their holiday check process?  Any modifications to it?  Anyone re-write theirs from scratch and come up with something more efficient?  

Here's a pic of the original subflow script that I started using back on IPCC Express release 3.0:

2020-0410-originalCheckHoliday.png

 

...after working on a few variations, I have modified/changed this to accomplish the same thing in 4 to 5 steps (add one feature: return the name of the holiday from the modified XML data file, with one more step).  I have to give props to Anthony H. for opening my eyes to XPath methods with which I was not familiar.

2020-0410-updatedCheckHoliday.png

...so, TodayIsAHoliday (Boolean) in a total of six steps, no looping, and huge savings on the Max Steps count.  Anyone else done something like this?

Thanks again, Anthony, for all the hints you give here... 

Hope this helps [someone].

-Sean

 

4 Replies 4

Anthony Holloway
Cisco Employee
Cisco Employee
Thanks for the mention Sean.

I'm still curious as to why the XML based holiday solution gained so much traction. I mean, scripting has always had Date objects and subflows, which is all you really need. In what way is introducing a new layer of technology (XML document creation and parsing) adding a benefit?

...can you provide a sample or reference? I'm curious. This is how I learned to use XML (in UCCX) and a holiday data set. I don't have a lot of java/JavaScript programming experience--so this is interesting. ….always something new to learn.
-Sean

Anthony Holloway
Cisco Employee
Cisco Employee

If you think about it, you could just pull only the name out, and if it's not null, then today's a holiday. This takes your solution down from 12 lines to 9 lines, and save you a step and a variable.

 

You could likely also drop the sDateToday variable and just use (new Date()) in the XPath to save another step and variable.  I did not test this, but in theory it should work the same with type casting in the Set step.

 

E.g.,

Line 1 : Start
Line 2 : docHolidayDatesTimeXML = Create XML Document (docHolidayDatesTimeXML)
Line 3 : sHolidayName = Get XML Document Data (docHolidayDatesTimeXML, "//Holiday[date='" + (new Date()) + "']/name") Line 4 : If (sHolidayName != null) Line 5 : True Line 6 : set bTodayIsAHoliday = true Line 7 : False
Line 8 : End