Hi All,
I need help on this.
Suppose I have value like 0000001.00000009
But in output i need the value like 1.00000009 (it mean i need to remove the leading zeros)
I specified trim as below
Trim(column,'0','L')
But it is working for only non-decimal values. For decimal values how it will be?
Please help on this.
Thanks
Pavan
how to remove leading zeros for decimal values
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 46
- Joined: Fri Oct 06, 2006 6:36 am
- Location: Tucson
-
- Participant
- Posts: 46
- Joined: Fri Oct 06, 2006 6:36 am
- Location: Tucson
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Is this the same project as this post?
Leading zeroes are merely an artifact - they do not matter for data type Decimal.
Leading zeroes are merely an artifact - they do not matter for data type Decimal.
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.
Re: how to remove leading zeros for decimal values
For the posted example: value 0000001.00000009
If we want the output as 1.00000009 the solution is given below with the logic;
USE THE LOCIG AS BELOW: (By using String function DecimalToString we can get the solution)
Field(DecimalToString(InputLink.xyz,"suppress_zero"),".",1):".":Field(DecimalToString(InputLink.xyz),".",2)
The above logic has two portions.
Firstly, the logic supress the leading zeros before the decimal point.
Secondly, it displays the values of after decimal values
The output will be ==> 1.00000009
Note:- let the data type be decimal coming from the input, but make it as Varchar while sending to output link with increase in the length
Hope this will solve your problem Pavan.
Thanks and Regards,
If we want the output as 1.00000009 the solution is given below with the logic;
USE THE LOCIG AS BELOW: (By using String function DecimalToString we can get the solution)
Field(DecimalToString(InputLink.xyz,"suppress_zero"),".",1):".":Field(DecimalToString(InputLink.xyz),".",2)
The above logic has two portions.
Firstly, the logic supress the leading zeros before the decimal point.
Secondly, it displays the values of after decimal values
The output will be ==> 1.00000009
Note:- let the data type be decimal coming from the input, but make it as Varchar while sending to output link with increase in the length
Hope this will solve your problem Pavan.
Thanks and Regards,
Prakash S Patil
Capgemini
Capgemini