Question

stop the numbers from rounding

  • 20 August 2015
  • 7 replies
  • 8 views

Badge
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

Userlevel 4
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
Userlevel 4
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
Userlevel 2
Badge +17
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
Badge
Ok, I think i figured it out where i lost the decimal.  I have expression evaluatore that (@Value(WorkType_count)/@Value(Total_Count))*100
Userlevel 4
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
Badge
Thank you everyone!
Userlevel 4
Takashi,

 

 

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

 

 

David

 

 

Reply