# AdapTable Reports

Canonical page: https://www.adaptabletools.com/docs/handbook-exporting-reports

- AdapTable provides 3 System Reports which can be run at any time
- Thes are designed to cover the most common use cases: `All Data`, `Current Layout` and `Selected Data`
- System Reports can be exported in various formats to all destinations

AdapTable ships with 3 System (i.e. predefined) Reports designed for frequently used exports:

| Report           | Contains                                                                  | Cols & Rows |
| ---------------- | ------------------------------------------------------------------------- | ----------- |
| `All Data`       | All Data in Grid's Dataset (i.e. all Rows and Columns)                    | All         |
| `Current Layout` | Data in current Layout (i.e. currently filtered Rows and visible Columns) | Visible     |
| `Selected Data`  | Currently selected Grid data (both Cells and Rows)                        | Selected    |

Additionally developers and run-time users can create bespoke [Custom Reports](https://www.adaptabletools.com/docs/handbook-exporting-reports-custom/index.md)

**Example: Exporting System Reports**

Exporting data from AdapTable using System Reports

 

- In this example AdapTable has been set up so that:
  - the Current Report is the `All Data` System Report
  - the Report Format is `JSON`

- Click the `Export` button in the Export toolbar and select 'Download'  to send the report as a `JSON` file

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'System Reports',
  initialState: {
    Dashboard: {
      Tabs: [
        {
          Name: 'Demo',
          Toolbars: ['Export'],
        },
      ],
    },
    StatusBar: {
      StatusBars: [
        {
          Key: 'Center Panel',
          StatusBarPanels: ['Export'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Export: {
      CurrentReport: 'All Data',
      CurrentFormat: 'JSON',
    },
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'license',
            'has_projects',
            'has_pages',
            'created_at',
            'has_wiki',
            'updated_at',
            'pushed_at',
            'github_watchers',
            'week_issue_change',
          ],
          Name: 'Standard Layout',
          AutoSizeColumns: true,
        },
      ],
    },
  },
};
```

### Limiting System Reports

By default all 3 System Reports will be shipped with AdapTable and available for use.

However this can be changed via the `systemReportNames` property of [Export Options](https://www.adaptabletools.com/docs/technical-reference-exporting/index.md).

The property returns a list (either directly or via a function) of which System Reports should be available.

### `systemReportNames`

Sets which System Reports are available for users

  [`SystemReportNames[]`](https://www.adaptabletools.com/docs/reference/systemreportname.md)

Use this property to specify a custom list of the System Reports which should be available to users.

You can return either an array of report names, or provide a function which returns an array.

<b>Hard Coded List</b>

The simplest method is to return an array listing which System Reports should be available:

```ts {4}
// Show just 'All Data' and 'Current Layout' System Reports
const adaptableOptions: AdaptableOptions = {
    exportOptions: {
        systemReportNames: ['All Data', 'Current Layout'],
    }
} 
```

Provide an **empty** array if you want **no** System Reports to be available:
```ts {4}
// Show No System Reports
const adaptableOptions: AdaptableOptions = {
    exportOptions: {
        systemReportNames: [],
    }
} 
```

<b>Via a Function</b>

Alternatively, you can provide a function which returns the System Report Names.

The function receives context of type  [`SystemReportNamesContext`](https://www.adaptabletools.com/docs/reference/systemreportnamescontext.md) defined as follows:

| Property | Type | Description |
| --- | --- | --- |
| [currentLayoutName](https://www.adaptabletools.com/docs/reference/systemreportnamescontext.md#currentlayoutname) | `string` | Name of current Layout |
| [defaultSystemReportNames](https://www.adaptabletools.com/docs/reference/systemreportnamescontext.md#defaultsystemreportnames) | [`SystemReportName`](https://www.adaptabletools.com/docs/reference/systemreportname.md)`[]` | Default System Report Names |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/systemreportnamescontext.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

```ts {4}
// Show just 'All Data' System Report when in 'Pivot View' Layout
const adaptableOptions: AdaptableOptions = {
    exportOptions: {
      systemReportNames: (context: SystemReportNamesContext) => {
        return context.currentLayoutName == 'Pivot View'
          ? ['All Data']
          : context.defaultSystemReportNames;
      },
    }
} 
```

Developers can supply a list of System Report names to this property and only these reports will be available.

- If the `Selected Data` report is removed from System Reports using the function above, the `Export Selected Cells` and `Export Selected Rows` Menu Items in the [Context Menu](https://www.adaptabletools.com/docs/ui-context-menu/index.md) will still remain
- Use the properties available in [Context Menu Options](https://www.adaptabletools.com/docs/technical-reference-context-menu/index.md) to remove these menu items completely

**Example: Configuring System Reports**

Configuring which System Reports are available

 

- In this example AdapTable has been limited to just 2 System Reports:
  - `All Data`
  - `Current Layout`

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Configuring System Reports',
  exportOptions: {
    systemReportNames: ['All Data', 'Current Layout'],
  },
  initialState: {
    Dashboard: {
      Tabs: [
        {
          Name: 'Demo',
          Toolbars: ['Export'],
        },
      ],
    },
    StatusBar: {
      StatusBars: [
        {
          Key: 'Center Panel',
          StatusBarPanels: ['Export'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Export: {
      CurrentReport: 'All Data',
      CurrentFormat: 'CSV',
    },
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'license',
            'has_projects',
            'has_pages',
            'created_at',
            'has_wiki',
            'updated_at',
            'pushed_at',
            'github_watchers',
            'week_issue_change',
          ],
          Name: 'Standard Layout',
          AutoSizeColumns: true,
        },
      ],
    },
  },
};
```
