" /> URS Macro's - Genesys CTI User Forum

Author Topic: URS Macro's  (Read 6144 times)

Offline blakemas

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
URS Macro's
« on: July 22, 2008, 09:44:27 PM »
Advertisement
G'day,

Can anyone point me in the direction of what the syntax is for using Macro functionality in URS? I have looked through the Genesys Documentation and maybe its me but there isn't alot of substance to what they have there.

Or Alternatively how do you build a case statement in URS 7.2 in one block?

Appreciate any help!

Cheers
Scott  ;D
« Last Edit: July 22, 2008, 10:02:17 PM by blakemas »

K

  • Guest
Re: URS Macro's
« Reply #1 on: July 23, 2008, 12:17:30 PM »
Have looked at using the Generic Segmentation object? That's about the closest to a CASE (or multiple IF) as you'll get...

Offline blakemas

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Re: URS Macro's
« Reply #2 on: July 23, 2008, 10:33:44 PM »
[quote]Have looked at using the Generic Segmentation object? That's about the closest to a CASE (or multiple IF) as you'll get...[/quote]

Thats fine for segmenting by expression you then need functional blocks for each function to do what you want for that case.  With a traditional case statement you have the expression and the function in one construct some what more efficient than segment then function.

In Macro block you can construct a multiple if  i.e;

var_current=1 -> Assign[var_track_1,var_track_current]
var_current=2 -> Assign[var_track_2,var_track_current]
var_current=3 -> Assign[var_track_3,var_track_current]
var_current=4 -> Assign[var_track_4,var_track_current]
var_current=5 -> Assign[var_track_5,var_track_current]
var_current=6 -> Assign[var_track_6,var_track_current]
var_current=7 -> Assign[var_track_7,var_track_current]
var_current=8 -> Assign[var_track_8,var_track_current]
var_current=9 -> Assign[var_track_9,var_track_current]

its the case else that gets messy... I would have to do something like

var_current!=1|var_current!=2|var_current!=3|var_current!=4|var_current!=5|var_current!=6|var_current!=7|var_current!=8|var_current!=9 -> Assign[var_track_error,'I shouldn't be here']

I suppose I could create a subroutine...

It was just a thought to see if anyone else had come across anything...

Offline victor

  • Administrator
  • Hero Member
  • *****
  • Posts: 1419
  • Karma: 18
Re: URS Macro's
« Reply #3 on: July 24, 2008, 07:57:48 AM »
Hi,

I know this sounds very very very stupid, but when do you use macros?

What is advantage to using macro over calling a sub-routine?

Best regards,
Vic

K

  • Guest
Re: URS Macro's
« Reply #4 on: July 24, 2008, 12:21:29 PM »
Hmmmm....

Based on my understanding of macros in URS, if you were looking to do as in your example, you would need to specify 10 parameters:
var_current
var_track_1
var_track_2
and so forth to
var_track_9

I believe then your logic would work, EXCEPT:

For the "case" statement you specified:
var_current!=1|var_current!=2|var_current!=3|var_current!=4|var_current!=5|var_current!=6|var_current!=7|var_current!=8|var_current!=9 -> Assign[var_track_error,'I shouldn't be here']

You should actually use "&" (and) instead of "|" (or). Otherwise the case would always execute.

Example:
Assume var_current = 2. The first clause (var_current != 1) would then be true, so the statement would execute.

Instead, taking from your example, you could summarize to:
var_current < 1|var_current > 9 -> Assign[var_track_error,'I shouldn't be here']



Offline blakemas

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Re: URS Macro's
« Reply #5 on: July 27, 2008, 10:23:35 PM »
[quote author=victor link=topic=3163.msg12987#msg12987 date=1216886268]
but when do you use macros? What is advantage to using macro over calling a sub-routine?
[/quote]

I guess it's easier to read in the logs as it doesn't jump out to a sub routine.  Other than that I wouldn't really know, just another way of doing things I suppose.

Offline blakemas

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Re: URS Macro's
« Reply #6 on: July 27, 2008, 10:37:58 PM »
[quote author=K link=topic=3163.msg12994#msg12994 date=1216902089]
You should actually use "&" (and) instead of "|" (or). Otherwise the case would always execute.
var_current < 1|var_current > 9 -> Assign[var_track_error,'I shouldn't be here']
[/quote]

You are quite right about the "&" instead of "|".  I realised after I posted it I had that wrong but I didnt get time to go back and fix it  :P.

That is a better summary, a little more thought on my part would help  :-[.

A better example of the problem would be...

GetRoutingPoint[] ='23945'-> Assign[var_walkaway,  'true']
GetRoutingPoint[] ='23944'-> Assign[var_walkaway,  'true']
GetRoutingPoint[] ='23445'-> Assign[var_walkaway,  'true']
GetRoutingPoint[] ='23444'-> Assign[var_walkaway,  'true']

How would you construct a case else for this?


K

  • Guest
Re: URS Macro's
« Reply #7 on: July 28, 2008, 01:14:34 PM »
In that example, I probably would still use a Generic Segmentation. Other than putting in a condition negating the ones above (GetRoutingPoint[] != '23945' & GetRoutingPoint[] != '23944' & ...), I can't think of a way to it in a macro.

A slightly different approach that may work:
If you put the valid routing points into a Key-Value list (that is, 23945:true|23944:true etc), you might be able to use the List Functions to retrieve the value, such as

[assuming RPList is my Key Value List]
GetStringKey(GetRoutingPoint[],RPList) != '' -> Assign[var_walkaway, true]
GetStringKey(GetRoutingPoint[],RPList) = '' -> Assign[var_walkaway, true]

The second line would be the "else" condition.

A less direct approach, but...

K

  • Guest
Re: URS Macro's
« Reply #8 on: July 28, 2008, 01:27:40 PM »
[quote author=victor link=topic=3163.msg12987#msg12987 date=1216886268]
I know this sounds very very very stupid, but when do you use macros?

What is advantage to using macro over calling a sub-routine?
[/quote]

One advantage I can see is it does not have the overhead that goes with executing a subroutine - pushing/popping variables, suspending execution of the current strategy, etc.

They are also useful for cases where you want to do something repeatedly. For example, I use a complex macro (below) to convert variables containing yes/no values into Y or N , so I only have to check for Y/N in an IF block, instead of "If YES or Y or yes or y"

<Macro EvaluateYesNo>
Parameters: InParam, OutParam
Definition:
StrToUpper[InParm]='YES'->Assign[OutParm,'Y']
StrToUpper[InParm]='Y'->Assign[OutParm,'Y']
StrToUpper[InParm]='TRUE'->Assign[OutParm,'Y']
StrToUpper[InParm]='NO'->Assign[OutParm,'N']
StrToUpper[InParm]='N'->Assign[OutParm,'N']
StrToUpper[InParm]='FALSE'->Assign[OutParm, 'N']
<End Macro>

I also use a macro to print custom messages into my URS log files.
<Macro PrintMessage>
Parameters: Message
Definition:
Print[Cat[ConnID[],Cat[':PRINT:',Message]]]
<End Macro>