CVP Call Studio - Converting String to Integer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 05:56 AM
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.
- Labels:
-
Customer Voice Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 06:19 AM
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
