Skip to main content
Question

stop the numbers from rounding


ruby
Participant
Forum|alt.badge.img+2
  • Participant
Hi, I am reading a Oracle SQL file and writting it to EXCEL.  My SQL file give me a value of 100.893657 and When I write that to EXCEL file it just writes 100 Or even writing to inspector it gives 100.  Is there a way I can tell FME to write the way it appears 100.893657.

7 replies

david_r
Celebrity
  • August 21, 2015
Hi

 

 

You will probably have to format the cells to display the decimals, otherwise Excel might only display the cell value rounded to the closest integer.

 

 

Lots of examples online, e.g. http://www.excel-easy.com/examples/custom-number-format.html

 

 

You might also want to consider using an Excel template file in FME to prevent redoing this all the time.

 

 

David

david_r
Celebrity
  • August 21, 2015
Also, you can define the output column as a number with a specified format, e.g.

 

 

 

 

Finally, verify that you do not perform any integer operations on your number before passing it to the writer. Famous examples include dividing it by an integer value in an ExpressionEvaluator (FME 2014 and earlier).

 

 

David

takashi
Influencer
  • August 21, 2015
Hi,

 

 

but the question mentions that "Or even writing to inspector it gives 100".

 

The decimal fraction has been lost during the translation process?

 

 

Takashi

ruby
Participant
Forum|alt.badge.img+2
  • Author
  • Participant
  • August 21, 2015
Ok, I think i figured it out where i lost the decimal.  I have expression evaluatore that (@Value(WorkType_count)/@Value(Total_Count))*100

david_r
Celebrity
  • August 21, 2015
Hi

 

 

Seems like you found it. In case you still need it, you can force a floating point operation by casting at least one of your attributes as a float, e.g. like this

 

 

(@double(@Value(WorkType_count))/@Value(Total_Count))*100.0

 

 

David

ruby
Participant
Forum|alt.badge.img+2
  • Author
  • Participant
  • August 21, 2015
Thank you everyone!

david_r
Celebrity
  • August 21, 2015
Takashi,

 

 

You were right, I saw that a bit too late, so added the last bit to my second reply :-)

 

 

David

 

 

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings