How to remove additional zeros in a record using Transformer
Moderators: chulett, rschirm, roy
How to remove additional zeros in a record using Transformer
Hi all,
i want to remove additional zeros from records using a transformer. I have tried with Trim function but it is not working .Also, please give the format in which this has to be done.
i want to remove additional zeros from records using a transformer. I have tried with Trim function but it is not working .Also, please give the format in which this has to be done.
-
- Participant
- Posts: 437
- Joined: Fri Oct 15, 2004 6:13 am
- Location: Pune, India
Whats your datatype for which you are trying to remove leading zeros?
If it decimal, then after removal, you will have to carry it as char or varchar or int. Because, in PX decimal are always have leading zeros when they are stored in datasets or carried through links (i.e. virtual datasets).
If your input is decimal and then use DecimalToString(InCol, 'supress zero')
If the in col is string, then a normal trim should work.
May be some special handling for first char of the col, will be needed as it will be sign char.
If it decimal, then after removal, you will have to carry it as char or varchar or int. Because, in PX decimal are always have leading zeros when they are stored in datasets or carried through links (i.e. virtual datasets).
If your input is decimal and then use DecimalToString(InCol, 'supress zero')
If the in col is string, then a normal trim should work.
May be some special handling for first char of the col, will be needed as it will be sign char.
Regards,
S. Kirtikumar.
S. Kirtikumar.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 783
- Joined: Mon Jan 16, 2006 10:17 pm
- Location: Sydney, Australia
ray.wurlod wrote:How precisely have you specified your Trim() function? ...
Hi,
I have tried with Trim function Trim("columnname","0","L") but this is not working.The data type is Char in input and output.Let me know if there is any other format which i need to give.With the above function used I am getting junked data in the output.Also i have tried various other formats of trim.
-
- Participant
- Posts: 437
- Joined: Fri Oct 15, 2004 6:13 am
- Location: Pune, India
You can use the TRIM() function on CHAR, but since the resultant output if of fixed length it will automatically pad the output according to string rules. You can use it to replace/remove zeroes.,Lucky wrote:...As far as I know Trim function works for Varchar data type. You cannot use Trim for fields which are of Char data type...
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Using the trim function as you have mentioned
Trim("columnname","0","L")
would only remove the leading zeros from the "columnname" specified.
You need to be clear if you would want to remove leading 0 or trailing 0 or anything in betn as well..
Using option "A" Removes all occurrences of character
"B" Removes leading and trailing occurrences of character.
"T" Removes trailing occurrences of character.
Hope this helps
Trim("columnname","0","L")
would only remove the leading zeros from the "columnname" specified.
You need to be clear if you would want to remove leading 0 or trailing 0 or anything in betn as well..
Using option "A" Removes all occurrences of character
"B" Removes leading and trailing occurrences of character.
"T" Removes trailing occurrences of character.
Hope this helps
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The OP has begun a new thread here on this topic.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I am not sure, but I will say that I was experiencing a challenge with a Lookup Stage as my input was Char and lookup reference was VarChar. Once I converted Char to VarChar (Transform Stage) it worked.Lucky wrote:Hi,
As far as I know Trim function works for Varchar data type. You cannot use Trim for fields which are of Char data type.
Please correct me if I am wrong.
<<<>>>
My opinions are just that.
My opinions are just that.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
With a Modify stage it might work even faster. You will still need a string_trim function, however. Refer to Orchestrate Operators guide for more information, as they seem to have left this function out of the Parallel Job Developer's Guide. This document may also prove useful.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.