Page 1 of 3

Problem using Convert in Transformer

Posted: Mon Feb 02, 2009 2:34 pm
by kittu.raja
HI,

I have a job which looks like

seqfile -----> transformer ---------> seqfile

The requirement is if the data is "]]CDATA]" then they have to change it to
"![CDATA[". when I tried to use convert I am getting "!!CDATA!". can anybody help me out.

Thanks,

**Note - Subject changed to be more descriptive - Content Editor**

Re: Transformer

Posted: Mon Feb 02, 2009 2:52 pm
by betterthanever
convert function does not work the way you are understanding...

it does not look for a string and replace it with the string you give...

but looks for the character by character
meaning for ex:

if you say convert('ab','cd',link.col)..
it replaces 'a' with 'c' and 'b' with 'd'...

Re: Transformer

Posted: Mon Feb 02, 2009 3:04 pm
by kittu.raja
[quote="betterthanever"]convert function does not work the way you are understanding...


Can you tell me how can I achive my target data?

Re: Transformer

Posted: Mon Feb 02, 2009 3:20 pm
by betterthanever
search the forum...you will get lot of info on this

Re: Transformer

Posted: Mon Feb 02, 2009 3:22 pm
by kittu.raja
betterthanever wrote:search the forum...you will get lot of info on this
I searched the form by replace a string, but I did not get the right one.

Re: Transformer

Posted: Mon Feb 02, 2009 3:24 pm
by betterthanever
[quote="kittu.raja"][quote="betterthanever"]search the forum...you will get lot of info on this[/quote]

I searched the form by replace a string, but I did not get the right one.[/quote]

check this

http://dsxchange.com/viewtopic.php?t=10 ... f69dc268a1

Posted: Mon Feb 02, 2009 3:47 pm
by ray.wurlod
You need something more complex, though a Convert() function is certainly involved. First you need a conditional expression, because the data won't always be "]]CDATA]". Then, assuming that this is the entire contents (rather than partial), you need to replace the first character with "!" and convert the remaining "]" characters to "[".

Hence

Code: Select all

If InLink.TheField = "]]CDATA]" Then "!" : Convert("]", "[", InLink.TheField[2, Len(InLink.TheField) - 1] Else InLink.TheField

Posted: Mon Feb 02, 2009 4:56 pm
by mk_ds09
Can you give more details about your requirements ?

Is everytime data is coming like '"]]CDATA]"' and you have to convert it to the "![CDATA[" ?

Or it is only the first occurance of the ] needs to be converted to the !.

Then you can just use convert on the rest of the string using convert and use concatanation for the first charater....

Posted: Mon Feb 02, 2009 6:12 pm
by ray.wurlod
If you had premium membership you would be able to read the complete solution in my earlier post.

Posted: Tue Feb 03, 2009 9:03 am
by kittu.raja
ray.wurlod wrote:If you had premium membership you would be able to read the complete solution in my earlier post.
K right now I am buying the premium membership

Posted: Tue Feb 03, 2009 9:04 am
by kittu.raja
mk_ds09 wrote:Can you give more details about your requirements ?

Is everytime data is coming like '"]]CDATA]"' and you have to convert it to the "![CDATA[" ?

Or it is only the first occurance of the ] needs to be converted to the !.

Then you can just use convert on the rest of the string using convert and use concatanation for the first charater....
Everytime I have to convert it and convert is not working on string replace

Posted: Tue Feb 03, 2009 9:14 am
by kittu.raja
ray.wurlod wrote:If you had premium membership you would be able to read the complete solution in my earlier post.
I bought the premium membership, but its still showing me premium content. Can you help me out.

Posted: Tue Feb 03, 2009 1:41 pm
by ray.wurlod
No, only the membership director can. You are not yet showing up as a premium member.

Posted: Tue Feb 03, 2009 1:59 pm
by kittu.raja
ray.wurlod wrote:No, only the membership director can. You are not yet showing up as a premium member. ...
I bought the membership today and shipping is downloadable. I did not get any downloadbale file and still its showing me participant

Posted: Tue Feb 03, 2009 2:01 pm
by kittu.raja
ray.wurlod wrote:You need something more complex, though a Convert() function is certainly involved. First you need a conditional expression, because the data won't always be "]]CDATA]". Then, assuming that this is ...
the data is not just "] CDATA". it contains a big staement in which CDATA is part of it. So I cannot use If then Else.