The Export Function provides a way to send data from AdapTable via saveable 'Reports' that can be run either manually or on a schedule.
AdapTable will always export the raw (i.e. underlying) value of any cell
Adaptable will popuplate the Export dropdown with your reports (and the shipped System reports) and allows you to export the data to a number of destinations.
Each Report has both Row and Column Scope to allow you define which Rows and Columns are contained in the Export
AdapTable allows you to create Reports which you can then send to multiple destinations.
There are 3 types of reports you can run:
Each report essentially contains 2 elements:
- Details of which Columns will be exported
- Details of which Rows will be exported
AdapTable ships with 4 predefined reports designed for frequently used exports. These are:
|All Data||All Data in the Grid's Dataset||Includes filtered columns and rows|
|Visible Data||All currently filtered columns and rows||Includes data not in current viewport|
|Selected Cells||Currently selected cells in the Grid||Do not need to be contiguous|
|Selected Rows||Currently selected rows in the Grid||Do not need to be contiguous|
By default all 4 System Reports will be present; use the
SystemReportNames of Export Config to change this by providing a custom list.
Leave the property empty to see all 4 System reports, or provide an empty array to have none available
User can provide at design-time (through Export State) or at run-time (via the Report Wizard) their own reports.
Each User Report will have its own column definition and row query.
Custom Reports are reports entirely generated at run-time by the User with no input from AdapTable.
Custon Reports do not need to include data (or columns) present in the grid in the exported data set.
Instead the data in the export is fetched each time the report is run via a function provided in UserFunctions (and referenced in Export State).
This allows developers to provide their own reports but still to leverage AdapTable state, scheduling and report destinations.
To define a Custom Report you need to do 3 things:
- Set the
- Set the
- Provide an implementation of the Custom Report User Function in which the data is returned in the form of a ReportData object
A report can be sent to a number of different locations including:
The Export to JSON sends the data using the ReportData format
and also - depending on whether the appropriate plugin is loaded:
If the Export Destinations offered by AdapTable are insufficient, developers can easily add their own custom report destinations via a user function.
Provide a custom, named implementation of the CustomExportDestination User Function in the User Functions section of Adaptable Options.
Reference that function by name in the
CustomDestinationsproperty (in Export section of Config).
AdapTable will then call this function whenever a report needs to be sent to that destination.
Custom Destination Forms
Sometimes you might wish to send additional information to the custom destination e.g. an email address.
This can be done by providing DynamicFormDef information in your Predefined Config.
This functionality is only availaible in AdapTable v7.1 and later
AdapTable will read this form definition metadata and create a form dynamically (including default values).
It will then send the completed form data as part of the user function args.
If the Custom Destination forms part of a Schedule export, the same dynamic form and form fields will be displayed in the Schedule Wizard
You can schedule your exports to run at at time of your choosing or export manually whenever you want, e.g. you can create an 'End of Day' Report to run every weekeday at 17:30.
Details of the schedule are stored in the Schedule section of Adaptable State.
Export includes the following UI Elements:
Popup - Shows all the available Reports together with an option to export to a destination of the User's choice. Plus an Add button to start the Export Wizard.
Toolbar - Shows all the available Reports together with an option to export to a destination of the User's choice. Also includes a Schedule button to enable reports to be run on Schedules.
Tool Panel - Same as Toolbar above.
Export Entitlement Rules:
Full: All Reports can be run and User Reports can be created / updated / deleted
Hidden: Reports can be run but not edited
Export Predefined Config
The Export Predefined Config allows developers to pre-populate their State with Reports, Custom Destinations and much else.
In this example we have created 2 Reports
- 'My Team Big Invoice' (the currently selected one) - which exports ALL Columns and any rows where the 'InvoicedCost' Column > 1000 AND the 'Employee' column value is one of 'Robert King', 'Margaret Peacock' or 'Anne Dodsworth'
- 'End of Day' - which exports 8 named Columns and ALL Rows. Note: we have also defined a Schedule so that the 'End of Day' Report will export to Excel automatically every weekday at 17:30
There are a few export-related options in the Export Options of Adaptable Options:
Export is a Data Export and not a WYSIWYG operation.
This means that AdapTable exports the raw values in the cells in the Report (and not the display values).
It also means that - with one exception - AdapTable does not export AdapTable Styles in a report.
The one exception is when Exporting the Visible Data System Report to Excel - which will include any Cell Styles that have been set in AdapTable functions (e.g. Conditional Styles, Formmat Column etc.).
To turn this off, set the
exportToExcelWithStyles property to false in Export Options
AdapTable exports the underlying raw data of the Grid.
This is by design as exporting a numeric cell which had been formatted in AdapTable with '$' for example would cause problems in the export destination.
AdapTable therefore formats all dates prior to Export, using the format set in the
exportDateFormat property of Export Options.
The default value for this property is 'dd-MM-yyyy'
The Export Api section of Adaptable API has a number of useful export-related functions:
|canExportToExcel()||If this AdapTable instance can to export to Excel; if false, the Export to Excel option will not be visible|
|editReport(report)||Edits an existing report|
|exportDataToExcel(reportData, fileName)||Exports data to Excel|
|getAllCustomDestination()||Retrieves all Custom Destinations in Export State|
|getAllReports()||Retrieves all Reports in State - both System and User-created Reports|
|getAvailableSystemReports()||Retrieves System Reports section of Export State|
|getCurrentReport()||Retrieves currently selected Report|
|getCurrentReportName()||Retrieves name of currently selected Report|
|getExportState()||Retrieves Export section from Adaptable State|
|getFormDefForExportDestination(destinationName)||Form Data entered by the User in the UI for a Custom Destination|
|getReportByName(reportName)||Retrieves Report with the given name|
|getReportSchedules()||Retrieves all Report Schedules|
|isDataChangeInReport(dataChangedInfo, report)||Whether given data change affects given report|
|isExportDestinationCustom(destinationName)||If the given destination is a Custom one|
|sendReport(reportName, destination, destinationData)||Sends a Report to a given destination|
|showExportPopup()||Opens Export popup screen|
Is the export 'live' - will it update when the grid data changes?
No - export is a one time only snapshot.
Do you include column names in the exported data?
Yes, column names are always included in the report.
Is there an option when just copying to the clipboard to exclude column names?
Not at present but this feature will be added in future releases.
Is there a limit on the number of reports that I can create?
No, reports like all other Adaptable Objects are unlimited.
Can I export the display formatted cell value in the column and not the raw value?
No, not at present. Export is a Data export and not a WYSIWYG function. However this will be addressed in future versions.
Why can I not see the Excel destination?
If you are using ag-Grid then you need to be using either ag-Grid Enterprise or have the 'Excel' module loaded for this option to be available.
Can I run a Report even though it will display data not in AdapTable?
Yes, use a Custom Report. Simply provide the function that will called each time the function runs and it can include any data you want.
Can I remove some System Reports?