" /> Reusable Time of Day Object - Genesys CTI User Forum

Author Topic: Reusable Time of Day Object  (Read 3100 times)

Offline littlematty

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Reusable Time of Day Object
« on: July 30, 2010, 12:22:53 AM »
Advertisement
Guys & Gals, my apologies if this has already been posted.  I have a situation where I am creating a generic strategy in IRD and I don't want to have the TOD block specified in the strategy.  I want to keep all the objects which could change outside the strategy in List Objects or Configuration data and as far as I know you can't have variables in a TOD block.  Has anyone come across a way to do it.  I have been playing around with a List where I grab the value from a key, then attempt some strasciitok functions to convert it into a time since midnight value and then compare to my opening and closing times, also converted to a time since midnight value.  Only thing is, I'm getting very weird results from my strasciitok function.  I've done all the usual checking variable definition types (int/float/var).  One simple one I'm doing is StrAsciiTok[var_Close_Time,'.',1] *3600000 + StrAsciiTok[var_Close_Time,'.',2] *60000 where var_Close_Time = 19.00 and I get a result of 68940000 when 7pm should equal 68400000.  Any suggestions would be greatly appreciated.

Offline kubikle

  • Full Member
  • ***
  • Posts: 140
  • Karma: 7
Re: Reusable Time of Day Object
« Reply #1 on: July 30, 2010, 01:13:17 AM »
Last parameter of StrAsciiToc is position in search string to start looking from.
StrAsciiTok[var_Close_Time,'.',2] start sarch from second char (19.00 -> 9.00) ans in such way you get additional 9*60000 milisecs. To resume StrAsciiTok from position where it lefts last time the 0 should be used.
StrAsciiTok[var_Close_Time,'.',1] *3600000 + StrAsciiTok[var_Close_Time,'.',0] *60000

Offline littlematty

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Reusable Time of Day Object
« Reply #2 on: July 30, 2010, 01:51:37 AM »
Thanks Kubikle for the reply.  I was "assuming" it positioned to the next result of the delimiter '.', hence taking me to the minutes part of my calculation.  Is there a way to move between the hours and minutes without having to do extra checking around how many characters were used in the hour part, ie, if you have 1 or 11 in the hour.  I don't want to leave it upto the person adding the time in the list object to alway enter it as 01 if its only a single digit hour for example and my strasciitok function is assuming 1 and 2 relate to hour, and 3 and 4 relate to minute.  Hope that makes sense.  Once again, thanks for the reply.

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: Reusable Time of Day Object
« Reply #3 on: July 30, 2010, 01:54:41 PM »
Hi littlematty,

StrAsciiTok function is quite powerful but man should know how to use it ;). If you have a string of values delimited by some special character (e.g. pipe) then you must call StrAsciiTok in following way
[code]strValue = "7|13|15|21"
1st value = StrAsciiTok[strValue,'|',1]
2nd value = StrAsciiTok[strValue,'|',0]
3rd value = StrAsciiTok[strValue,'|',0][/code]
There is another option how to implement working hours using Statistical Days and Statistical Tables. You will then pass Statistical Table name as parameter to your strategy and check the result using IsSpecialDayEx.

R.

Offline Kevin S

  • Full Member
  • ***
  • Posts: 145
  • Karma: 4
Re: Reusable Time of Day Object
« Reply #4 on: July 30, 2010, 05:50:10 PM »
My solution is not as dynamic as you might be looking for, but...
I created two sets of attributes in IRD - one for Hours of Operation and one for Business Days.

In Business Days, I created each of my days (which I called dMonday through dSunday, because the word names are reserved word constants in IRD) as  "Day[] = (day of week)". For example, [b]dMonday[/b] as "[b]Day[] = Monday[/b]"
and [b]Weekdays[/b] as "[b]Day[] >= Monday & Day[] <= Friday[/b]"

For hours of operation, I created attributes like
[b]0800_to_1800_ET[/b] as "[b]TimeInZone['EST']>= '08:30 AM' & TimeInZone['EST']<= '06:00 PM' [/b] "

(I created one attribute for each set of business hours)

I then created a business rule for each combination, for example
[b]MF_0800_1800 [/b] as (attribute) [b]Weekdays[/b] and (attribute) [b]0800_to_1800_ET[/b]

In my team routing definitions, I refer to the same value as the Business Rule, and evaluate it in a chain of Segmentation objects (up to 5 evaluations per chain, to make it managable). When I hit my desired value, I go to a BusinessRule Object which is set for the appropriate Workday + Hours combination.

I stuffed [b]ALL[/b] this into a subroutine. The input parameter is the desired value (MF_0800_1800), and the output is a value to indicate whether that team is closed or not.


If I could find a function to call a business rule, it would make this a LOT cleaner, but it's been in place for 5+ years.