Skip to main content
12-Amethyst
April 1, 2019
Question

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

  • April 1, 2019
  • 2 replies
  • 1238 views

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
April 1, 2019

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.

12-Amethyst
April 1, 2019
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.