Skip to content

calculate

This function allows you to calculate a report in the background without rendering it to the user.

Syntax

calculate()

Return

A boolean indicating overall success.

As the report is calculated asynchronously the return of this method will not indicate that the report has completed calculation.  For this you will need to bind to the calculation:complete event.

Examples

The following code will call back to the server and calculate the named report and retrieve data from it, without ever rendering that report.

// On the post render of any given calculation
// Find our button and bind a click event to it to calculate the report when clicked
 
report.api.bind("postrender", function(){
    // Get an element from inside the report

    var button = report.api.getElements("#myCalcButton")
 
    if (button.length > 0) {
        // Bind a click event to the button
        button.click(() => {
            report.api.calculate()
        })
    }
})
Back to top