Page 1 of 2

transformation

Posted: Tue Mar 19, 2013 8:20 am
by smohd1338
Hi, if in input field, "Change Section Design" i need output as CSD , the first letter of each word in the input.how do i dot his?

Posted: Tue Mar 19, 2013 8:23 am
by prasannakumarkk
is space only the delimiter for the words?
is three words the maximum?

Posted: Tue Mar 19, 2013 8:30 am
by smohd1338
yes, sapce is the only delimeter, but its not just 3 words, it can be 4, or words or 2 or 1, input may also come lilke "input may also come lilke" then output is IMACL

Posted: Tue Mar 19, 2013 8:48 am
by prasannakumarkk
For now i can think like this. Considering the maximum number of words as n.

Code: Select all

   LEFT (FIELD (lnkIp.ip_column, " ", 1), 1)
|| LEFT (FIELD (lnkIp.ip_column, " ", 2), 1)
|| LEFT (FIELD (lnkIp.ip_column, " ", 3), 1)
.
.
.
|| LEFT (FIELD (lnkIp.ip_column, " ", N), 1)
I dont think we can loop in some way.
This is the option to get first character of a string.

Posted: Tue Mar 19, 2013 8:53 am
by prasannakumarkk
There must be a size for the input column so we can somehow conclude the value N.
And in the above solution irrespective of any number of words in input it will gives us result

Posted: Tue Mar 19, 2013 9:08 am
by smohd1338
the size is 150 varchr coming in input, looks liek the value of N can be anythng between 1-10 mostly

Posted: Tue Mar 19, 2013 9:16 am
by prasson_ibm
Hi,
If you are in version 8.5 and above,you can use the power of transformer caching.

Posted: Tue Mar 19, 2013 9:18 am
by prasannakumarkk
yeah you know the data very well. you can repeat the function any number of times. guess 25 will be better

Posted: Tue Mar 19, 2013 9:22 am
by smohd1338
I am using 8.1

Posted: Tue Mar 19, 2013 9:24 am
by chulett
That would be pretty trivial in a Server routine. Any chance of using a BASIC Transformer in your job?

Posted: Tue Mar 19, 2013 9:24 am
by prasannakumarkk
Hmm i expected this. Can you explain how we are acheiving it in higher version
If you are in version 8.5 and above,you can use the power of transformer caching.

Posted: Tue Mar 19, 2013 1:27 pm
by ray.wurlod
Use BASIC Transformer stage and Oconv(InLink.TheString, "MCT")

Posted: Tue Mar 19, 2013 2:23 pm
by chulett
Ray, isn't that the same as CAPITALS? If so they just the first letter of each word, not the first letter of each word capitalized. If I am mis-remembering what "MCT" does, forgive me...

Posted: Tue Mar 19, 2013 2:53 pm
by ray.wurlod
CAPITALS is a Transform that encapsulates Oconv(%Arg1%, "MCT")

Posted: Tue Mar 19, 2013 2:57 pm
by chulett
That's what I thought... meaning it won't solve their problem. :wink: