04-10-2020 08:20 PM
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:
...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.
...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
04-13-2020 10:32 AM
04-13-2020 10:35 AM
04-13-2020 11:03 AM
04-13-2020 02:25 PM
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
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