Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Time Check

I am using UCCX 7

My user wants to be able to limit the number of call allowed in the queue after a certain time in the day.

so far I just have two Time variables strTimeNow and strCustTime

I set strTimeNow to = T[Now] for the current time

Then set strCustTime to a string value of any time i.e 14:00:00

then use an IF to see if the strTimeNow > strCustTime

if true limit calls to 2 if not carry on.

Its seems to work ok but wanted to check if anyone can see a problem doing this

3 ACCEPTED SOLUTIONS

Accepted Solutions
Super Bronze

Re: Time Check

Hi

That should work fine - I use T[Now] comparisons with opening times stored in/retrieve from XML to allow customers to change their opening times dynamically and it works great.

Regards

Aaron

Please rate helpful posts...         

Aaron Please remember to rate helpful posts to identify useful responses, and mark 'Answered' if appropriate!

Re: Time Check

Use the builtin .after or .before methods for Time objects, depending on your needs.

key_time = t[14:00:00]

/* are we past the key time of day for queue limits? */

if (t[now].after(key_time)) {

     /* yes, limit the queue */

     ...

}

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Re: Time Check

Create a variable of type java.sql.Timestamp.  Then your DB Get step will show it as an option.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
22 REPLIES
Super Bronze

Re: Time Check

Hi

That should work fine - I use T[Now] comparisons with opening times stored in/retrieve from XML to allow customers to change their opening times dynamically and it works great.

Regards

Aaron

Please rate helpful posts...         

Aaron Please remember to rate helpful posts to identify useful responses, and mark 'Answered' if appropriate!
New Member

Re: Time Check

thanks Aaron

do you have an example of how your doing time check. I am currently using a series of IF statements comparing the hour and minutes of the day for bespoke open/cloe times but seems long winded

Re: Time Check

Use the builtin .after or .before methods for Time objects, depending on your needs.

key_time = t[14:00:00]

/* are we past the key time of day for queue limits? */

if (t[now].after(key_time)) {

     /* yes, limit the queue */

     ...

}

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
New Member

Re: Time Check

You can also use the "Time Node" available in General Tab of Pallete in Script Editor. I have also used this to check time based queing. i.e after a certial time of the day I am sending calls to VRU Node that no agent is available in this time. etc.

Regards,

Hammad.

New Member

Re: Time Check

quick one on this.

I want to get my open and close time from a database

if I store the time as "datetime" in sql no variable in IPCC picks this up

if I store its as a string in sql I can't convert it in IPCC to a time format i.eT[12:00:00]

hwo do you over come this?

Thanks

dave

Re: Time Check

Create a variable of type java.sql.Timestamp.  Then your DB Get step will show it as an option.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
New Member

Re: Time Check

ok kso in my DB I have a two fields

strOpenTime= 09:00:00

strCloseTime=22:30:00

Both are set to type datetime

in the script I have two variables of type

java.sql.Timestamp

Names

DBTimeOpen

DBTimeClose

Value = Null

when I run the script the two variables get populated like this

DBTimeOpen =D[December 30, 1899 9:00:00 AM]

DBTimeClose=D[December 30, 1899 10:30:00 PM]

The Time now is displaying as 19:00:00 (so no AM or PM )

so how do I convert this D[December 30, 1899 9:00:00 AM] to T[09:00:00]

Thanks

Re: Time Check

Why are your dates from the end of the 19th century?  That's odd.

The answer to your question depends on how you want to use the variable.  So, what is your intention?

And on a side note, T[09:00:00] is not valid.  You would do either Time.valueOf("09:00:00") or T[09:00:00 AM]

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
New Member

Re: Time Check

no idea why that value from the databse comes from the 19th century

as i said both datatype in sql are "datetime"

what I have had to do is store the times as string values and use the string.valueOf() to convert it

last thing now it to compare the time now with open and close

i tried using  If TimeNow.after(OpenTime) && TimeNow.before(closeTime) Then

Open

else

False

but I dont think it like the && i.e two checks in one IF

Re: Time Check

but I dont think it like the && i.e two checks in one IF

That's not your problem, I have done things like the attached before.

I could help you better if you shared more about your script.  On the surface it seems like you are doing it correctly, so I need to see more.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
New Member

Re: Time Check

All I have in the script so far is

Cal_Now=T[Now]

TimeOpen= [09:00:00]

TimeClose=[23:55:00]

then an IF

If

(Cal_Now.after(TimeOpen) )&& ( Cal_Now.before(TimeClose))

but when using the combined if I can never get a True result from the IF. if I take away the && and use a single statment like

(Cal_Now.after(TimeOpen) ) this works

Re: Time Check

mymite060708 wrote:

All I have in the script so far is

Cal_Now=T[Now]

TimeOpen= [09:00:00]

TimeClose=[23:55:00]

then an IF

If

(Cal_Now.after(TimeOpen) )&& ( Cal_Now.before(TimeClose))

but when using the combined if I can never get a True result from the IF. if I take away the && and use a single statment like

(Cal_Now.after(TimeOpen) ) this works

First, your TimeOpen and TimeClose variables are set wrong.  When using the Time literal T, you must specify the AM/PM designator.  You also forgot the T/t.

Additionally, if the step let's you click Apply or OK, then there's nothing wrong with the way you wrote the step.  So what actually is the part that's failing?  Maybe throw up a screenshot of your script.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
New Member

Re: Time Check

hi

this is he script i am using so far. I think the problem is with the .before part

Thanks

Re: Time Check

I'm very confused as to how you even typed the Time values into the editor.  It should have errored when you pressed OK.

Attached, you will find a screen shot of the validation errors (you should always validate your scripts), and the corrected script.

Basically, you are using the Time literal and the Class method incorrectly.  See the fixed script for proper use.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
New Member

Re: Time Check

Hi Mate

Still not working. see attached screen shot (debug) .- did it work for you?

It deffinetley seems to be the .before part that it does not like if I use < or > instead of .after and.before it works

Also I did a validation on my script and no errors were found (see attached validation) also when I moved through the script the sting value 11:00:00 is automatically converted to 11:00:00 AM.

Re: Time Check

Now that I go back and run it, I see that it *is* falling to the wrong branch.  There is something fundamentally wrong with your editor, as it allowed you to type invalid syntax, and generate corrupt code.

I see that you are running on something less than UCCX 7.0(1) SR4, and I am on 7.0(1) SR5.  What is your version?  Can you upgrade, or patch?

Here is a screen shot of a brand new 7.0(1) SR5 script doing exactly what you wanted, and working.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Re: Time Check

Anthony, I would appreciate your help with a script that I am making almost identical to this. I have been searching the forums for an answer to my problem and this one comes closest to a possible solution. I am using an if statement to check if the time a caller has called in, is between two time variables that I define with the "parameter" tag so that an end user can change the open and closed settings freely. The problem I am running into is when I upload the script and change the times for open and closed it works great. If I run the same script the next day it doesnt work and always goes to the closed portion of the script. The T[now] parameter seems as if its carrying along a date stamp with it. If I refresh or reupload the script it works like a champ again that day but then bombs the next.  I read on another post while searching that someone solved this exact issue by using the T[now].hour instead of the T[now]. I cannot get the T[now].hour to even take when I type it in. Any help would be appreciated.

Tracy

New Member

Re: Time Check

Hi,

Appreciate if you could send thescript where you are doing the time comparisons with XML file and also the XML file format.

One of my customer wants to input the call centre closing hours time from IP Phone(by calling the IVr number) and update in XML file.

Thanks

Re: Time Check

XML Example:

     8:00 AM

     5:00 PM

Variables (treat these like default values):

Time open = t[7:00 AM]

Time close = t[6:00 PM]

Script Example:

xml = create xml doc(xml)

open = get xml data(xml, "/Schedule/Open")

close = get xml data(xml, "/Schedule/Close")

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
New Member

Re: Time Check

SO i would like to use basically an XML file that can be edited by the end customers as a an early closure check so they can schedule the time they want the call center to close early for the holiday. Would your example work for that?

New Member

Re: Time Check

Hi

I am running 7.0(1) SR4. Tested this on 3 editors all running the same level so it looks like a bug with this build level.

I will update to SR5 and test again.

thanks again for your help

Re: Time Check

Oh I see now.

debug script.PNG

     Shows the palette search box

validation.PNG

     Does not show the palette search box

I made the statement of SR4 when I looked back at validation.PNG

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
1128
Views
10
Helpful
22
Replies