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. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

UCCX - Convert 'Get Digit String' value into Integer

 

I have to use the Get Digit String method to pull a 2 or 3 digit number (stored as variable callbackDelay) from a caller; this number is obviously stored as a string. I need to convert this string to an integer in order to perform multiplication on this variable and use it with the Delay option.

 

I have tried using Set as follows:

Set callbackDelay = int.parseInt(callbackDelay)

 

But apparently this is not converting callbackDelay from a string to an integer because I am still recieving an error when trying to perform multiplication on this variable or when using it with Delay.

 

Any ideas on how to approach this would be greatly appreciated!

Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Java is a strongly typed

Java is a strongly typed lanaguage.  If your variable callbackDelay is of type String, it will never be able to store an int.  You will need a second variable of type int to store the result of your Set step.  Also, note that the Set step will always try to type cast for you.  So, simply doing:

Set my_int = my_string

Will convert your string to int.

EDIT: which also explains why your attempt to convert it stayed a String.  The Set step converter your int from your String, back into a String.  Kind of funny.

Anthony Holloway

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

Java is a strongly typed

Java is a strongly typed lanaguage.  If your variable callbackDelay is of type String, it will never be able to store an int.  You will need a second variable of type int to store the result of your Set step.  Also, note that the Set step will always try to type cast for you.  So, simply doing:

Set my_int = my_string

Will convert your string to int.

EDIT: which also explains why your attempt to convert it stayed a String.  The Set step converter your int from your String, back into a String.  Kind of funny.

Anthony Holloway

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

Anthony, you are the man!!

Anthony, you are the man!! Thank you!

 

New Member

 Actually, in order to get

 Actually, in order to get this to work I had to create a new variable named "my_int" and then do the following:

 

Set my_int = int.parseInt(my_string)

 

Without the parseInt method, the "my_int" variable kept getting the value of 0 despite the value of "my_string".

 

 

Shouldn't have had to.  I

Shouldn't have had to.  I have been using this feature of the set step for years, and it still works that way in UCCX 10.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
370
Views
0
Helpful
4
Replies