Trim function
Moderators: chulett, rschirm, roy
Trim function
I have a field that I am bringing in from a flat file. I am using the TrimB and TrimF function but when I do a length in the database, it includes a place for the space/blank. How can I make it only include real data and not spaces?
-
- Charter Member
- Posts: 17
- Joined: Tue Mar 21, 2006 1:00 pm
I had the same problem in one of my jobs. I resolved it initially in a roundabout way by calculating the length by using Index function on first space to get the length of the string and then moving (1, length) to the output field.
Later I found that if you define your field as VarChar in all the stages TRIM works properly. In one of my stages inbetween I had the field definition of Char that cuased the issue. Please check whether you definied the field as VarChar in all stages. If you still have the issue try using my first roundabout method. Good Luck.
Aruna.
Later I found that if you define your field as VarChar in all the stages TRIM works properly. In one of my stages inbetween I had the field definition of Char that cuased the issue. Please check whether you definied the field as VarChar in all stages. If you still have the issue try using my first roundabout method. Good Luck.
Aruna.
Re: Trim function
Check the flat file to see, if you are getting spaces or un printable characters. Remeber TRIM will not consider these un printable characters for trimming.lsnovick wrote:I have a field that I am bringing in from a flat file. I am using the TrimB and TrimF function but when I do a length in the database, it includes a place for the space/blank. How can I make it only include real data and not spaces?
You could check this by opening the file in unix, which will not show complete line or you can download the file to your local machine and open the file in texpad to see, if you have these characters in it...
Hmm i will fill this when ever i get one