Page 1 of 1

Trim Function

Posted: Wed Oct 11, 2006 4:41 am
by Vajranath
I have data in column like this

1)

1ABC
12ABC
123 ABC
in each record ABC present . only 3 letters.

i want output like
1
12
123

can any one help me in this?

2) Column records are
ABC1
ABC12
ABC123

I want output like

1
12
123

help me ..

Posted: Wed Oct 11, 2006 5:01 am
by Kirtikumar
As per what I got from your example - in scenario one values will be appended with ABC and second prefixed with ABC.

case 1 - Use the Index first to locate the occurence of ABC and then from input extract substring starting from 1 till (value returned by Index - 1).

case 2 - Extract the substring starting from 3 till (length of input column - 3)

howw to use substring

Posted: Wed Oct 11, 2006 7:12 am
by Vajranath
Kirtikumar wrote:As per what I got from your example - in scenario one values will be appended with ABC and second prefixed with ABC.

case 1 - Use the Index first to locate the occurence of ABC and then from input extract substring starting from 1 till (value returned by Index - 1).

case 2 - Extract the substring starting from 3 till (length of input column - 3)
Kirtikumar,
can you guide me how to use substring ?
please give one example...

Posted: Wed Oct 11, 2006 7:17 am
by Nageshsunkoji
Hey Vajranatah,

Try out this function in Transformer stage :

Trim(Convert('ABC',' ', DSLink3.Example)).

Hi All,

This function is working and its converting multiple charcters into one specified character.

Regards
Nagesh.

Posted: Wed Oct 11, 2006 7:25 am
by kris007
Nageshsunkoji wrote:Try out this function in Transformer stage :

Trim(Convert('ABC',' ', DSLink3.Example)).
This function is working and its converting multiple charcters into one specified character
That is what the TRIM function does when the option is not specified :wink:

Posted: Wed Oct 11, 2006 7:43 am
by ArndW
Remember that CONVERT('ABC','',"This BCA") will return "This "; the CONVERT function works on a character-by-character basis and not on the whole string.

Posted: Wed Oct 11, 2006 7:53 am
by kumar_s
Actually Trim function eliminates the given string and not the conversion.

Posted: Wed Oct 11, 2006 8:11 am
by Nageshsunkoji
Hi All,

I don't know, what Miracle happened with my Datastage. The Convert function is Working for me. It's replaced the Multiple characters into one charcter. I tried by converting the 'ABC' with ' '.

I got the result without Trim function and I have used trim to remove spaces from string which are resulted due to conversion function.

Regards
Nagesh.

Posted: Wed Oct 11, 2006 8:16 am
by kumar_s
Again you are eliminating the 'ABC' with '' opton passed. Where the possible options are 'L', 'R','B'...
Try to convert to some other characther. You can find the difference.

Posted: Wed Oct 11, 2006 8:18 am
by ArndW
kumar_s wrote:Actually Trim function eliminates the given string and not the conversion.
In the example the CONVERT is executed before any TRIM.

Posted: Wed Oct 11, 2006 8:29 am
by kumar_s
Inspite of repeated post, somehow I didnt noticed the CONVERT function within Trim.
Nagesh - Arnd has already explained the way how CONVERT works.
I shouldn't be wake up even after 12:30 AM. :evil:

Thanks

Posted: Thu Oct 12, 2006 10:55 pm
by Vajranath
Nageshsunkoji wrote:Hey Vajranatah,

Try out this function in Transformer stage :

Trim(Convert('ABC',' ', DSLink3.Example)).

Hi All,

This function is working and its converting multiple charcters into one specified character.

Regards
Nagesh.
Trim(Convert('ABC',' ', DSLink3.Example)).
above function works.
Thanks for all