Skip to main content
12-Amethyst
Apr 1, 2019 2:42 AM UTC
Question

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

1-Visitor
Apr 1, 2019 2:30 PM UTC

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.

Translate
12-Amethyst
Apr 1, 2019 2:38 PM UTC
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.
Translate