Page 1 of 1

right truncate in transformer

Posted: Tue Aug 25, 2009 3:18 pm
by arnie_nits
Hi,

I have a column like QDL Marine and Static Diesel Engines (In).
Now I need to make it like QDL Marine and Static Diesel Engines (In).The length of this value differs from record to record.

I tried with convert but then it become QDL Marie ad Static Diesel Egies.

Please suggest.

Thanks,
Arnie

Posted: Tue Aug 25, 2009 3:28 pm
by chulett
:? There's no difference between your 'before' and 'after' examples that I can see. It looks like you tried to remove all of the 'n' characters but I can't see why. Yet.

Help us out here.

Posted: Tue Aug 25, 2009 3:31 pm
by chulett
Are you trying to remove the last word from the field? Is what you need actually "QDL Marine and Static Diesel Engines" in this example?

Posted: Tue Aug 25, 2009 3:36 pm
by arnie_nits
Yes sir

Posted: Tue Aug 25, 2009 3:47 pm
by chulett
The trims may not be strictly needed but make this more fool-proof:

Code: Select all

Field(Trim(YourField)," ",1,DCount(Trim(YourField)," ")-1)
Pop quiz: what exactly is this doing? :wink:

Posted: Tue Aug 25, 2009 3:57 pm
by chulett
So, Arnie... not going to take the pop quiz? :(

I generally don't like to give pure code solutions for things like this as I'm afraid there's no learning going on, one can simply plug it in and move on without have to actually understand how it works. I feel like I'm handing out fish rather than a fishing pole. Oh, well, hope you take the time to break it down and understand the bits so you can leverage the techniques elsewhere should the need arise.