View #181 on GitHub to know more details
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()
.
@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.
Can you document an example how you can use it?
Can you document an example how you can use it?
It would be astonishingly appreciated
Documentation added as part of #199 and hence closing this issue.