Jira Assistant Issues

View #181 on GitHub to know more details

#181 - Allow Math functions in expressions

Crissov commented on Jun 07, 2022

In a custom report, I'm using the option to use Expressions for formatting a field. However, I cannot find documentation what exactly should be possible inside an Expression. The text below the edit box in the popup says:

Provide JavaScript expression to print a value. You can use "this" to refer to the current field and "Fields" variable to refer to the object containing all the fields.

When I'm trying to use functions from the JavaScript Math object, e.g. Math.round(), I get an SyntaxError: Unexpected token error message in the respective report table cells. I wish I could use at least these functions, maybe you could alias them if you don't want to allow all of Javascript in Expressions, and without the Math. part the Expression would actually remain quite readable.

PS: I note that I can use methods of the this object, e.g. this.toLocaleString().

shridhar-tl commented on Jan 14, 2021

@Crissov - You are right. I currently did not allow any of the global methods available in JavaScript. I will enable the Math object and few more global function which would be useful in most of the cases. I would try to make it this weekend.

FROSADO commented on May 14, 2021

Can you document an example how you can use it?

over1pixel commented on Oct 21, 2021

Can you document an example how you can use it?

It would be astonishingly appreciated

shridhar-tl commented on Jun 07, 2022

Documentation added as part of #199 and hence closing this issue.