11-03-2020 11:08 AM
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.
11-03-2020 12:11 PM
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
11-03-2020 12:27 PM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide