Is there a way to make a reusable expression?

Posted by: rdillon on 31 March 2022, 12:13 am EST

    • Post Options:
    • Link

    Posted 31 March 2022, 12:13 am EST

    I have an expression which I use to calculate a percentage field in a table. Right now I copy and paste it into each cell and then change the data fields which I am using for each cell. Is there a way to write a reusable expression with variables that can be passed into it? Like a JavaScript function. This way if there is a change to the calculation I only need to do it in one place for the report. Thank you.

  • Posted 31 March 2022, 7:29 pm EST

    Hello, You could use calculated fields as described at Data Binding

  • Posted 1 April 2022, 1:44 am EST - Updated 2 October 2022, 11:06 pm EST

    Thank you for the reply. Unfortunately, that doesn’t seem to be quite what I was hoping for. I’ve uploaded a screen grab from my designer file. The 3rd row of data is a big calculation using the 2 fields above it (two other dataset fields). Even with the calculated field I would need to make a field with a distinct calculation for each one (like 20 times). I’m hoping to just have a function I can drop in and pass the fields needed for the calculation.

  • Posted 3 April 2022, 8:24 pm EST

    Hello, Thanks for providing the clarification. As of now, ActiveReportsJS does not have the feature that would allow using the custom code for calculations. However, we have it in our plans for the future major version(v4.0)

  • Posted 4 April 2022, 1:48 am EST

    Ok, thank you for the reply.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels