cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
776
Views
0
Helpful
5
Replies

Drop digits from inputted digit string???

blcase
Level 1
Level 1

How do I drop or remove digits from a inputted digit string step? - a bank wants to collect account numbers and needs to drop all leading zeros - this could be one or two zeros or none at all depending on the account number. Is there a way for the script to look at the digits inputted, and drop leading zero's if any? i.e. if I input "00123456789" as my account number - the agent (the number is going to be used for a screen pop) needs to see "123456789" - how would I do this?

5 Replies 5

geoff
Level 10
Level 10

The easiest way with IPIVR/CRS is to write a custom Java class. You need to have the "Premium" licence in order to add your own Java classes to the engine. If you have this option in IPCC Express or IPIVR, Java classes are the way to go.

You don't say if you are using ICM/IPCC. If so, and if you can't use Java classes, you could probably do this with ICM scripting.

Load it into a Peripheral Variable (pv) in IPIVR and hand it back to ICM. Then manipulate the string someting like ...

One leading zero:

if subscript(pv,1,1) = "0" && subscript(pv,2,1) != "0" then new_pv = subscript(s,2,(len(pv)-1))

Two leading zeros:

if subscript(pv,1,1) = "0" && subscript(pv,2,1) = "0" && subscript(pv,3,1) != "0" then new_pv = subscript(s,3,(len(pv)-2))

You get the idea. Make a custom function.

we are using IPCC Express - and don't have the premium license only the enchanced - any other thoughts?

OK, no custom Java class.

I am sure you could do this with the built-in Java classes. You have access to all the Java String methods. How's your Java?

Not that great I'm afraid - when looking at the java options - it not real clear to me what the different methods do - the editor guide doesn't give any explaination of them at all. Any help you could provide would be appreciated. But I think I see your point - I think it *could* be done - I'm pretty sure I can get it to look at the data - but I think what is throwing me is how to remove the digits.

I don't play with IPCC Express much, but this should work for you.

I wrote this on IPIVR with a IPCC Enterprise 6.0. The only thing that may throw you is the welcome prompt I used - I just borrowed the one from Auto Attendant.

You enter a string of up to 12 numbers - use the pound key to stop entry before 12. It reads the numbers back to you after stripping off any leading zeros. Then it loops back for another go.

There are lots of comments in here so you can understand how the Java classes and methods can be used. I hope you can follow it.

The basic algorithm is:

while (str.length() > 1 && str.substring(0,1) == "0")

{

str = str.substring(1, str.length());

}

I have tested this, but you must validate all corner cases (like no entry).

Regards,

Geoff