Time Check

Answered Question
Mar 3rd, 2010

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

I have this problem too.
0 votes
Correct Answer by Anthony Holloway about 6 years 9 months ago

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

Correct Answer by Anthony Holloway about 6 years 9 months ago

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 */

     ...

}

Correct Answer by Aaron Harrison about 6 years 9 months ago

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...         

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (5 ratings)
Loading.
Correct Answer
Aaron Harrison Wed, 03/03/2010 - 06:01

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...         

mymite060708 Wed, 03/03/2010 - 07:21

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

Correct Answer
Anthony Holloway Wed, 03/03/2010 - 08:56

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 */

     ...

}

hammad.saleem Wed, 03/03/2010 - 10:14

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.

mymite060708 Fri, 03/05/2010 - 09:21

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

Correct Answer
Anthony Holloway Fri, 03/05/2010 - 10:29

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

mymite060708 Fri, 03/05/2010 - 11:55

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

Anthony Holloway Fri, 03/05/2010 - 12:48

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]

mymite060708 Fri, 03/05/2010 - 13:07

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

Anthony Holloway Fri, 03/05/2010 - 14:09
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.

Attachment: 
mymite060708 Fri, 03/05/2010 - 15:56

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

Anthony Holloway Fri, 03/05/2010 - 18:38

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 Sat, 03/06/2010 - 19:50

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.

Attachment: 
Tracy Larson Tue, 10/19/2010 - 20:39

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

ra_jeshkalra_2 Thu, 03/04/2010 - 00:45

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

Anthony Holloway Thu, 03/04/2010 - 20:27

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")

texasjet79 Tue, 08/17/2010 - 18:25

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?

mymite060708 Mon, 03/08/2010 - 02:18

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.

Attachment: 
Anthony Holloway Mon, 03/08/2010 - 06:43

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.

Attachment: 
mymite060708 Mon, 03/08/2010 - 08:03

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

Anthony Holloway Mon, 03/08/2010 - 08:56

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

Actions

This Discussion