Page 1 of 1

what function to use for replacing string?

Posted: Wed May 26, 2010 11:47 pm
by vinsashi
Hi,
my source is like
field001,field002
101,reddy ysr reddy
102,raja reddy is reddy


here i want to replace reddy with "abc" i used convert function but not getting desired output
i want output like this
field001,field002
101,abc ysr abc
102,raja abc is abc
if i use convert function it taking as characters. so getting wrong output..

thanks in adavance
v....

Posted: Thu May 27, 2010 12:22 am
by gssr
Post the syntax you used for the function, Also post the output you are getting!

Posted: Thu May 27, 2010 12:31 am
by vinsashi
i used this function
convert("reddy","abc",field002) i got this output like
output
field001,field002
101,abcc sa abcc
102,aaj abcc is abcc

i am getting this output

Thanks
v..

Posted: Thu May 27, 2010 1:19 am
by ETLJOB
The convert function will not replace the entire string as you mentioned. It works in the following way. It replaces

"r" with "a"
"e" with "b"
"d" with "c" in your case.

To replace the entire string you can leverage the ereplace() or change() functions. Search it!

Posted: Thu May 27, 2010 2:36 am
by ray.wurlod
Moderator: topic relocated as requested

The answer for a server job is to use the Ereplace() function.

Posted: Thu May 27, 2010 7:14 am
by priyadarshikunal
use pxEreplace for parallel jobs posted a while ago by DSGuru2B!