Processing Reports
Summary
- Developers can "process" (i.e. intercept) a report before it is evaluated and exported
- This is used in 3 main use cases:
- running the report on the server and sending the data back to AdapTable
- cancelling a proposed Export
- providing entirely new column and row data
All AdapTable reports can be processed before they are exported.
This allows developers to provide a function implementation enabling them to:
- evaluate the Report on the server (typically when using the Server-Side Row Model)
- configure whether the Export should take place
- provide an entirely different set of report data
Caution
Processing should be avoided when using the VisualExcel Report Format
Procesing is configured using the processExport property in Export Options which can return 3 values:
ExportResultDataobject (provided on Server) - will be used as data for Report and exported by AdapTabletrue- Report will be evaluated by AdapTable as normal, using Grid data (provided by AdapTableQL)false- the export will be cancelled and no report will run
processExport
Promise<ExportResultData | boolean>Exporting via the Server
The most common use case for processing reports is when running export on the server.
Hint
This most typically happens when using the Server-Side Row Model
Developers can evaluate the report on the server, and return the report data to AdapTable for it to export to the selected destination.
- This demo illustrates how to use the
processExportproperty in Export Options to create report data on the Server and return to AdapTable to export - It is taken from the more extensive Server-Side Row Model Demo focussing purely on Export
- Both the (System) 'All Data', and the (Custom) 'US Golden Athletes' Reports are evaluated on the server, and the data is sent back to AdapTable to export
- Run the 'All Data' or 'US Golden Athletes' Reports and note how the data is provided 'on the server' and then send back to AdapTable
Cancelling an Export
Because the function can return a boolean, this can be leveraged to set whether the proposed Report runs.
This allows developers to decide dynamically whether or not the user can run the given report.
Hint
The boolean value can be returned asynchronously if required, allowing server permission checks
- This demo illustrates how to use the
processExportproperty in Export Options to stop a particular Report from being run. - We do not allow the
Current Layoutreport to be run (and output a System Status Message to that effect)
- Run the 'Current Layout' Report and note that the export is prevented (with a System Status Message displayed)
- Switch to a different Report and this time the export works as normal