Solved

How can I round numbers in steps of 500 with FME?

  • 27 July 2021
  • 2 replies
  • 38 views

Dear FME community,

 

I have attributes which contain numbers with several integers like 5800386.006999999 as values. I would like to round these values in steps of 500. So the number above becomes 5800500. If the value is closer to e.g. 5801000 then it should be rounded to that number. If it is closer to 5800000 then it should be rounded to that. The values can have a lot of decimal places or none. This means the solution should be able to handle any given number.

 

I am very thankful for any help.

 

Thank you so much in advance!

icon

Best answer by gazza 27 July 2021, 11:43

View original

2 replies

Badge +5

Divide the number by 500. Round it to the nearest integer. Multiply by 500.

In the AttributeManager it will look like

@Evaluate(@round(@Value(number)/500,0)*500)

Thank you so much for your help. It works perfectly!

Reply