cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
235
Views
0
Helpful
1
Replies

CVP Call Studio - Converting String to Integer

ln33147
Level 4
Level 4

Hello,

This is regarding a CVP environment version 12.6(1)
We are trying to use a "Database Element" in Call Studio to connect to an MSSQL database and execute a Select Query.

The Select query is working just fine if we define the caller number manually. However, if we use the Session Data Variable (_ani), we're getting the following error "The error was: A built-in element encountered an exception of type com.audium.server.AudiumException. Arithmetic overflow error converting nvarchar to data type numeric".

Could anyone advise how to properly use a "Set Value" element to convert a VARCHAR to an Integer before passing it to the database?

Thanks in advance.

1 Reply 1

Gerry O'Rourke
Spotlight
Spotlight

the 'trick' is NOT to use the eval - as this converts a number back into a float, e.g. "5" becomes "5.0"
below is an example - where I convert a value PollDurationInt which equalled so a value like "4.123" and I convert it to "4".

var pollDurationInt; 
pollDurationInt = {Data.Session.pollDuration};
pollDurationInt = parseInt(pollDurationInt,10);
pollDurationInt = pollDurationInt .toString();
pollDurationInt;

i.e. if the last line was eval(pollDurationInt);
this would NOT return an integer - but be converted back to a float - which took me a while to figure out!

Regards,

Gerry