To have numbers only in a phone number column.

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

To have numbers only in a phone number column.

Post by saraswati »

Please let me know how we have only numbers for a phonenumber column.

For Example: (304)-645-7865

I just to get the number as 3046457865 .To be more simple, I want only numbers from 0-9 in the phone number column. Eliminate ( ), [], Ext,- etc...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

On the Server side you have the DIGITS transform but on the PX side I'd just fall back on Convert, I do believe:

Code: Select all

Convert("()[]-. ","",YourField)
Something much like that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

Post by saraswati »

I don't what all non-numeric characters might come so it will be better if we can have some transformation so that it contains only numbers from 0-9.
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

I'm not sure if there's a function in parallel but if you can use a BASIC_Transformer, you can use Oconv('String',"MCN") to just get the numbers alone from your string.
Arun
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That would be the DIGITS transform I noted.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

saraswati wrote:I don't what all non-numeric characters might come so it will be better if we can have some transformation so that it contains only numbers from 0-9.
OK. If you are expecting complete crap in your phone numbers then the old "double convert" trick may be in order:

Code: Select all

Convert(Convert("0123456789","",YourField),"",YourField)
-craig

"You can never have too many knives" -- Logan Nine Fingers
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

Post by saraswati »

You mean to say by using

Convert(Convert("0123456789","",YourField),"",YourField)

if the input value is (879)-986-5623 [5421] then I will get the output as

87998656235421.

RIGHT?????
max.madsen
Premium Member
Premium Member
Posts: 62
Joined: Tue Dec 07, 2004 7:41 am
Location: Brasil
Contact:

Post by max.madsen »

Right..
The solution its very interesting..
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

Post by saraswati »

Thanks a lot....it worked fine.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

max.madsen wrote:The solution its very interesting..
Yes, it is. I was quite impressed the first time I saw this posted as it wasn't something that had occured to me to do. Basically, the first convert removes all of the characters you want to keep from your string, generating a custom list of all of the unwanted characters in that particular value and that output is used in the next convert to remove them. 8)
-craig

"You can never have too many knives" -- Logan Nine Fingers
stuartjvnorton
Participant
Posts: 527
Joined: Thu Apr 19, 2007 1:25 am
Location: Melbourne

Post by stuartjvnorton »

saraswati wrote:Convert(Convert("0123456789","",YourField),"",YourField)
Nicely done. :-)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You're welcome. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply