Skip to main content
Solved

Calculation using ExpressionEvaluator

  • February 20, 2025
  • 4 replies
  • 76 views

leanne_michael
Contributor
Forum|alt.badge.img+2

Hi all - fairly new to FME here.

I am trying to do a calculation using the ExpressionEvaluator to calculate tree protection zone (TPZ) estimate, and round to 2 decimal places. 

The formula I’m using is @round(@Value(average_dbh_value) * 0.12, 2)

 

I also need to incorporate min and max values into the output. Min is 2 and Max is 15. This is where I’m getting stuck. Would someone be able to provide a suggestion on how I can possibly achieve this?

 

Thanks

Leanne

Best answer by ctredinnick

If you mean to cap the value to a minimum of 2 and a maximum of 15, you can do that with a max and min function like so. 

@max(2,@min(15,@round(@Value(average_dbh_value) * 0.12, 2)))

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.

4 replies

geomancer
Evangelist
Forum|alt.badge.img+59
  • Evangelist
  • February 20, 2025

You can calculate Min and Max using a StatisticsCalculator.

Use Group Processing to calculate these values on specific groups of input features, grouping by one or more attributes..

 


ctredinnick
Supporter
Forum|alt.badge.img+19
  • Supporter
  • Best Answer
  • February 20, 2025

If you mean to cap the value to a minimum of 2 and a maximum of 15, you can do that with a max and min function like so. 

@max(2,@min(15,@round(@Value(average_dbh_value) * 0.12, 2)))


leanne_michael
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • February 21, 2025

Thankyou! The above formula worked. Yes - I did mean cap the value to a min 2 of 2 and a max of 15. 

 

Appreciate the help.


geomancer
Evangelist
Forum|alt.badge.img+59
  • Evangelist
  • February 21, 2025

You can also use the clamp function for this:

@clamp(@round(@Value(average_dbh_value)* 0.12, 2), 2, 15)