on 07-22-2009 7:40 PM
I'm mapping a phone number from the idoc to the XML file.
I only want to send the first 12 characters of a phone number.
For example, if the phone comes in as, "123-456-7890 Ext 44", I only want to send "123-456-7890".
I thought I could use the substring function(0 to 12), but I get an error if the phone is not exacly 12 characters long.
I need to be able to process the value of the phone number if it's:
Blank
Has text like "no phone".
1234567890
123-456-7890
Is there a std function to do this, or would I need a custom java udf?
Thanks,
jeff
Jeff
check length and if is greater than 12 do substring else pass as it is.
Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jeff,
Are you able to resolve it by Luis Ortiz method.
Add TELF1 -
substring 0-12 -
to THEN
Add TELF1 to else.
TELF1 --Substring --THEN
Cheers
Agasthuri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jeff,
you can write a UDF with the following conditions.
I am not so good at Java programming. Hence I am giving you the logic try to draft a UDF using Java.
for(i=0; i<=11; i++) //worst case you are interested in first 12 values in the incoming payload incl "-"
{
1. If the read character is one of the alphabets or "" do not pass //to take care of blank or no phone or NA
2. If the read character is - do not pass.
3. If the read value is digit, pass it
}
if the concatenated string == 10 then pass it to target field.
if concatenated string =="", do not pass or take corresponding action.
this ways, the "NA" or "no Phone" or "" will be filtered out
Hope its useful
Venkat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi jeff
You can use and UDF function , however you can mapping with standar function.
Map like this
Phone Number >> length >> greater than constant [12] >> IF >> (if length > 12 you use Substring else only pass the element)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.