Skip to main content

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

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..

 


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)))


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.


You can also use the clamp function for this:

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