Hi All,
My target is a file which contains amount columns of 22 width. 16 for integer part, 1 for decimal point, 4 for decimal digit. 1 for sign.
for example : 0000000000000000.0000, if we have -ve sign it should be -0000000000000000.0000.
My question is if it is a +ve number it should have leading space but I'm getting trailed space.
how to achieve a leading space if it is a +ve number.
Thanks in advance
Fixed width file
Moderators: chulett, rschirm, roy
If your source is already a string,
if left(number,1) <> '-' then ' ' : left(number,21) else number
However, if your source is a decimal, just place it in a decimal (20,4) column and use DecimalToString(). The default conversion should give you what you're looking for.
Regards,
if left(number,1) <> '-' then ' ' : left(number,21) else number
However, if your source is a decimal, just place it in a decimal (20,4) column and use DecimalToString(). The default conversion should give you what you're looking for.
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
for example from source table x and y columns had values like 234.5 and -145.64 then in file it should display as
0000000000000234.5000-0000000000000145.6400
(if it is positive number it should have a leading space so that the total width will be 22 characters.)
(if it is negative number with sign i will get 22 characters).
Thanks in advance
0000000000000234.5000-0000000000000145.6400
(if it is positive number it should have a leading space so that the total width will be 22 characters.)
(if it is negative number with sign i will get 22 characters).
Thanks in advance