cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
730
Views
0
Helpful
2
Replies

Call Studio Script - Length Function

TulioDiniz
Level 1
Level 1

Hi guys, can you help me with something?

 

I'm building a CVP script using Call Studio application. Using the Digits Element, the application collects 11 to 14 digits entered by the user. After that, I need to identify the number of entered digits (length). Does anyone knows how to do it?

 

Thanks in advance. 

2 Replies 2

There are two ways.

 

1. Use the decision element and check that the value is greater than 9999999999 and less than 1000000000000000. I didn't count all the zeros and nines, but hopefully you get what I mean.

2. Use an action element and in the settings use JS, here's an example for something unrelated but pretty close.

var ani = {CallData.ANI};
var npanxx = "";
if(ani.length >10){
npanxx = ani.substring(1,7);
}else if(ani.length<11){
npanxx = ani.substring(0,6);
}else{
npanxx = "000000";
}
npanxx

 

david

 

Thank you for your response. 

 

The first solution won't work for me. It is possible that the user inputs some Zeros on the left and those digits still have to be considered. For example, 00060305000104 is still a 14-digits valid string for me. 

 

I'll give a try on the second solution and i'll let you know.