Calculation in Mendix

0
Hi guys, Anyone know how to translate this calculation formula from Excel? I find the radians formula, but cannot find in the document. Thank you.  
asked
1 answers
1

You may need to drop into Java to this. 

For example, if you need the COS function, a Java Action that takes a Decimal input and returns a Decimal could be implemented using the following...
 

// BEGIN USER CODE
return java.math.BigDecimal.valueOf(java.lang.Math.cos(this.Parameter.doubleValue()));
// END USER CODE

 

Using the same approach, RADIANS could be implemented using the following…
 

// BEGIN USER CODE
return java.math.BigDecimal.valueOf(java.lang.Math.toRadians(this.Parameter.doubleValue()));
// END USER CODE


If your formula doesn’t change, it may be easier to put the whole calculation into a Java Action, but that would potentially be harder to maintain in the future.

Hope this helps.​​​​​​

answered