cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

762
Views
0
Helpful
2
Replies
Jay Cambell
Beginner

UCCX Ver 8 adding XML

                   I'm having trouble with a script pulling the data from an xml file.  I would like the script to run normal Monday thru Friday but on Saturday run on the first and third.  On my script have a holiday xml already but I would like to add an xml for first and third saturday.  I'm having trouble with the path. I attached a screenshot of the xml and script. I'm not sure if I'm add the xml file in the wrong location on the script as well.

2 REPLIES 2
Anthony Holloway
Cisco Employee

you can have the script calculate the first and third saturdays of each month for you automatically.

Would you be willing to do that, or does it have to live in the XML document?

Gergely Szabo
Advocate

Hi,

er... your XML structure is a tiny bit overcomplicated - is it something you can control? If yes, can't you create something like this:

 

 

>

This would be easier to work with. For instance, using an XPath expression like this

count(//specialdate[@date="5/2/2012" and @from>"5" and @to<"23"])

or just simply

//specialdate[@date="5/2/2012" and @from>"5" and @to<"23"]

Of course, "5/2/2012" and "5" and "23" should countain actual date and time (hour) values.

As pointed out by Anthony, Java can help you getting the day of week in month - and check against the actual date. For example, if you add a new boolean variable named isSpecialDate and use a Set step to assign its value to a code block like this:

Set isSpecialDate = {

        java.util.Calendar calendar = new java.util.GregorianCalendar();

        calendar.setTime(new java.util.Date());

        if (calendar.get(java.util.Calendar.DAY_OF_WEEK)  == java.util.Calendar.SATURDAY && (

                calendar.get(java.util.Calendar.DAY_OF_WEEK_IN_MONTH) == 1 ||

                calendar.get(java.util.Calendar.DAY_OF_WEEK_IN_MONTH) == 3

                )

        ) {

            // it's that special date

               return true;

        } else {

            // just a regular rainy day

               return false;

        } //else

}//block

then the value of the isSpecialDate variable would be true if it's the first or third Saturday of the month.

G.

Content for Community-Ad