cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
211
Views
2
Helpful
3
Replies

CVP Call Studio - Set Value Element - returns string as a float?

Gerry O'Rourke
Spotlight
Spotlight

Using the "set value" element in CVP Call Studio - I am parsing a string.

lets say you have a string "000.111.222"
And you want to split this up into "000", "111" and "222"

using the set value element - you split this up into an array (with "." as the separator) - e.g.
myArray = myString.split('.');

And then you can extract for example the second element "111" by doing the following
myvar = myArray[1];

However the value of this always seems to be a float and so outputs as "111.0" and not "111"
I have tried to convert the output to a string, to an integer - but everything I have tried has failed to work?
Always outputs as a float?

Any ideas? Anyone else have this issue?

Gerry

3 Replies 3

Could you do something kludgy like send the value to the Math element and then take it from there since that outputs as a string?

david.macias
VIP Alumni
VIP Alumni

I am not getting the same results. Here's my very simple app:

davidmacias_0-1738849473293.png

Here's my activity log:
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:58.992,,start,newcall,
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:58.992,,start,ani,NA
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:58.992,,start,areacode,NA
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:58.992,,start,exchange,NA
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:58.992,,start,dnis,NA
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:58.992,,start,uui,NA
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:58.992,,start,iidigits,NA
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:58.992,CVP Subdialog Start_01,enter,
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.071,CVP Subdialog Start_01,exit,done
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.071,Set_Value_String,enter,
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.289,Set_Value_String,custom,myValue,Success
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.289,Set_Value_String,custom,Result,Success
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.289,Set_Value_String,custom,**SetValueString,000.111.222
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.289,Set_Value_String,exit,done
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.289,Split_Value_String,enter,
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.289,Split_Value_String,custom,mySplitValue,Success
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.289,Split_Value_String,custom,Result,Success
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.289,Split_Value_String,custom,**mySplitValue,org.mozilla.javascript.NativeArray@32617d85
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.289,Split_Value_String,exit,done
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.289,array0,enter,
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.305,array0,custom,array0,Success
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.305,array0,custom,Result,Success
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.305,array0,custom,array0,000
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.305,array0,exit,done
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.305,array1,enter,
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.320,array1,custom,array1,Success
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.320,array1,custom,Result,Success
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.320,array1,custom,array1,111
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.320,array1,exit,done
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.320,array2,enter,
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.336,array2,custom,array2,Success
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.336,array2,custom,Result,Success
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.336,array2,custom,array2,222
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.336,array2,exit,done
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.336,CVP Subdialog Return_01,enter,
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.383,CVP Subdialog Return_01,exit,
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.383,,end,how,app_session_complete
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.383,,end,result,normal
192.168.15.131.1738849498961.0.BasicApp,02/06/2025 08:44:59.383,,end,duration,0

Albert
Level 1
Level 1

Hello Gerry,
I could not replicate the issue in debug log. Even when I tried to assign the float value to local variable.
But I think the issue would be solved like this:
myvar = String(myArray[1]);

Please let me know if this had fixed the issue.