cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Is there a way to call Math functions like Math.hypot() in a service?

SajidPatel
8-Gravel

Is there a way to call Math functions like Math.hypot() in a service?

To pre-process for analytics, I need to calculate some values. It would help immensely if I could utilize Math functions like hypot(),  etc. Does anyone know, how I can make use of these functions in a service? 

 

I did notice that some functions do work like sqrt() for example, but not all, I am specifically interested in hypot at this time. 

2 REPLIES 2

The easiest thing for you to do might be to write your own Math resource extension.  You would create a new "Resource" extension and define all the functions you need. Then you can use native Java to calculate the result and return it to TWX.

Well, that would be the last option. Currently, I am sort of doing the same by defining an utility thing with reusable services. I would like to take advantage of efficient JavaScript algorithms that are predefined if there is a way to do that.
Top Tags