Page 1 of 1
Convert Function - Mulitple Characters as a set for replace
Posted: Thu Dec 11, 2008 11:43 am
by snt_ds
Hi,
I am trying to replace all the characters 'XX,' to '' (Empty) using the Convert function..As I underatand it replaces each character seperately and hence my output is not as expected.
I want to change "XX,XX,XX,6,XX,7" to "6,7"
Any other way to replace this entire set in one go?
Thanks,
NV
Posted: Thu Dec 11, 2008 12:21 pm
by kandyshandy
Are you using a server job or PX job? If server job, there are functions like EReplace.. If you are using a PX job, use BASIC transformer.
Posted: Thu Dec 11, 2008 12:40 pm
by snt_ds
Yes I know..
But this is a PX job as reflected in the Job Type in the Post header
Posted: Thu Dec 11, 2008 12:44 pm
by kandyshandy
Then use the BASIC transformer in your PX job and use EReplace function.
Posted: Thu Dec 11, 2008 1:12 pm
by snt_ds
Thanks for your Great Advice but not an Efficient one!
We figured out a solution in PX..
using Trim(Convert('XX','',ARG),',','R')
Thanks,
NV
Posted: Thu Dec 11, 2008 1:27 pm
by chulett
I believe you'll find that DSGuru2B posted a PX version of EReplace here some time back. If memory serves.
Posted: Thu Dec 11, 2008 2:09 pm
by ray.wurlod
Convert works one character at a time.
That it worked for you was pure luck - all you got was each "X" converted to "A". Therefore "XX" would have been converted to "AA".
Posted: Thu Dec 11, 2008 2:16 pm
by kandyshandy
As Ray told, convert works on one character at a time. If you are fine with using convert, then just to let you know... you can replace that convert with another trim too !!
one trimA to remove all X and another trimR to remove unwanted commas.
Or you could correct your statement to Trim(Convert('X','',ARG),',','R')