Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncating decimals

Status
Not open for further replies.

kashush

Programmer
May 2, 2003
38
US
My map truncates 3.40 to 3.4. I don't want this to happen.

If the number comes in as 5.1 then I don't want to add an additional 0 at the end to make it 5.10. The data should look exactly how it initialy came.

I am using DSTX 7.5(119).

The type trees are created from an initial type tree that is generated from an oracle database.

The numbers are defined as decimals with decimal

I would prefer NOT to redefine the numeric items as text.

How do I stop the truncation and avoid additional 0's?
 
You need to modify the type tree. Make sure you column is defined as number/char/decimal; then separators/yes/(select separator format)/literal/.; then place/decimal_min/decimal_max.....


 
I think you'll have to define the field as text, let us know if you find a work-around though.
 
Janhes,
But won't that still add on the 0 if the inbound is 5.1?

What you are trying to handle is a text field, despite the fact that it uses the characters 0 - 9 with a decimal in the middle of the field. Numerically, 5.10 is the same as 5.1.

If two input objects are 3.40 and 5.1 you want to see 3.40 and 5.1 on the output, not 3.4 and 5.1 or 3.40 and 5.10. I don't believe you can have both.

Dropping the trailing zero from a decimal number does not change the numeric value of said number. So you would need to use a text field to represent the inbound data. I know you said you didn't want to, but I'm not really understanding why.

I may be off on this, but I'm pretty sure you're going to have to use text for the fields.
 
if the output is Number, Decimal, Seperator ####[.##], pad = no, places min=0 max=2 then it truncates the trailing zero from the decimal place.
You can define the inbound the same or as text.
 
Ah! I misread the requirements - if input is 1.10 then output is 1.10 inpit 1.1 out 1.1. Yes in this case you will need to use a text value.
 
Hmmm.... Maybe I'm missing something. The requirements were keep numeric, always populate with 2 decimal positions. You can do that without making it text. We do it all the time, text to numeric, numric to numeric, one decimal to two...
 
No input is 1 or 2 decimal places so output needs to be the same with trailing 0.

"My map truncates 3.40 to 3.4. I don't want this to happen.

If the number comes in as 5.1 then I don't want to add an additional 0 at the end to make it 5.10. The data should look exactly how it initialy came.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top