Skip to main content
Solved

How to get/calculate reminder and rounding numbers?

  • September 27, 2018
  • 2 replies
  • 212 views

bobo
Contributor
Forum|alt.badge.img+3
  • Contributor
  • 46 replies

Hi, everyone, I'd like to do some math calculations in FME, just like Field Calculator in ArcGIS. I'm trying to calculate reminder and rounding numbers, but I'm not sure which math operator to use. Here're some examples:

Reminder: 5÷3, result:2; 10÷6, result:4

Rounding:5÷3, result:1; 10÷6, result:1

And I also want to add zeros before some results if their digits are less than 3.

I can get it done in ArcGIS by using python, reminder operator is %, rounding operator is //, and zfill function to fill zeros. How can get the same result in FME? I've read the Math Operators help document, it only has % as reminder, no rounding and zfill. I have over 600000 rows of record to calculate, when I do this in ArcGIS, the software will just crash. Please give me a hand.

Best answer by david_r

Remainder = @fmod(5,3) or 5 % 3

Rounding: @floor(@div(5,3))

Padding: StringFormatter transformer

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

david_r
Celebrity
  • 8394 replies
  • Best Answer
  • September 27, 2018

Remainder = @fmod(5,3) or 5 % 3

Rounding: @floor(@div(5,3))

Padding: StringFormatter transformer


bobo
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • 46 replies
  • September 28, 2018

Remainder = @fmod(5,3) or 5 % 3

Rounding: @floor(@div(5,3))

Padding: StringFormatter transformer

Thank you, got it worked!