# Exporting a Report Model

Astera makes it easy to export data from a report model directly to a number of different destination types such as Excel and CSV. Moreover, it supports export of data to a wide range of on-premise and cloud databases including SQL Server, Oracle, DB2, Sybase, MySQL etc.

{% embed url="<https://youtu.be/AxLarXFHWaY>" %}

### Sample Use Case

In this example, we have incoming data extracted by the report model below.

Download the sample data file and report model from [here](https://www.astera.com/Downloads/Misc/2020/07/Exporting-Data.zip).

{% file src="<https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fr90Oi6YmEtJwJCVponuI%2FExporting-Data.zip?alt=media&token=3f08f93d-55b8-43d6-a882-112468250b0f>" %}

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FlVDyGB5ZNYTbHnZDW2b9%2F1-report-model.png?alt=media\&token=1ce9fc56-57ed-40e9-950f-692132c66f9f)

The model contains a hierarchical structure with three data regions and multiple fields.

Click on *Preview Data* icon placed in the toolbar above the report model designer. A *Data Preview* window will open, displaying the extracted data.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FrQc2dQThDhIKdSiCWcJZ%2F2-data-preview.png?alt=media\&token=48c0279b-cb13-4f10-aa33-fcf0daacc205)

Let’s export the data extracted by this report model to an excel destination, a CSV file and a SQL database table.

### Exporting to an Excel Destination

1. Select the *Create New Export Settings and Run (to Excel)* icon placed in the toolbar under the Model Layout panel.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Faumbyngi9HT8pvdyrG3I%2F3-excel-destination.png?alt=media\&token=6a162367-a67e-40e3-b0b8-075db20e6450)

&#x20;      A configuration window will open. This is where the export properties are defined.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FzZwmxGDE4yRZtVipR4lS%2F3-empty-file-path.png?alt=media\&token=6c7efa8b-20db-4a1e-a87a-8ad5894a8e32)

2. Provide the *File Path* where Astera will save the exported data with a *.xlsx* extension.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F3o7la01HggsAo0a4Xxd0%2F3-file-path.png?alt=media\&token=4506a46b-7abf-423f-99bf-a01b639035ae)

Once you have provided the destination *File Path*, you can choose multiple options from the export setting window to configure the data export file.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FQ3Mnnnb0sUFjQhgZjEdC%2F4-options.png?alt=media\&token=dac9ada0-c169-4537-848d-66da2a0ea788)

* *First Row Contains Header* – Directs Astera to read headers from the source file.
* *Worksheet* – Specifies the title for the worksheet to export the data to within the Excel file.
* *Append to File(If Exists)* – Adds the exported data to an existing excel sheet without overwriting the data it contains.
* *Write to Multiple Files* – Saves the exported data to multiple files instead of one single file. Specify the same file in multiple Excel destinations and Astera will create a single file with multiple worksheets and writes all data to that file.

*Rules for Filtering* – Specifies a criterion to export only filtered records to an excel sheet. On expanding, users can see an expression box with built-in functions to facilitate a rule-based filtering. This feature is explained in detailed in the next section.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F4fo5EwQytJKdIkbEA4ns%2F5-rules-for-filtering-data.png?alt=media\&token=b4c263a4-b2fc-4a16-8fa8-a51404faec0a)

3. Click *Next*. This is the *Layout Builder* screen where the extracted data fields can be modified as per the requirements.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FWfHsRvJHPKLE2lj1xjRE%2F6-layout-builder.png?alt=media\&token=7ea68165-c6e4-4c53-9ead-5b5ecb253950)

4. Click *OK*, this starts the export of data. View its job trace in the *Job Progress* window.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fjkc9lwocQ3eXwUEL0tlf%2F7-job-progress-1.1.png?alt=media\&token=02062554-49a3-44fc-be45-aa371008c216)

At the end of a successful run, Astera will generate the Excel file and provide its clickable link in the job trace.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FHtefLvjNe53QpQon1KAq%2F7-job-progress.png?alt=media\&token=f2fbfb5e-2c5d-4927-9390-81c3d43ebfbb)

The export to an excel sheet is complete.

### Exporting to a CSV File

1. Select the *Create New Export Settings and Run (to CSV)* icon placed in the toolbar under the Model Layout panel.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FsaK8ccwVIq7BapRWjNBt%2F8-csv-export.png?alt=media\&token=fa1d15cc-ce60-4a7f-8cf8-1c0c0b756e61)

A configuration window will open. This is where the export properties for CSV files are defined.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F03zNxZqvFDudYUk3kcUO%2F9-export-window-csv.png?alt=media\&token=4cf9c346-76d6-4d58-93f1-8042ad61cd02)

2. Provide *File Path* where Astera will save the exported data with a *.csv* extension.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FqWPy4Qu0rNoHopTSi1Q4%2F10-file-location.png?alt=media\&token=1cd7898a-f31a-45c9-864c-4229a169d034)

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FUliWa8ophfuanLQLkNXv%2F11-options-csv.png?alt=media\&token=9a5cd986-30d2-48d1-b024-0d42d6fb7278)

Once the *File Path* has been provided, move onto the other options to configure the exported file.

<table data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><ul><li><em>First Row Contains Header</em> – Directs Astera to read headers from the source file.</li></ul></td><td><ul><li><em>Field Delimiter</em> – Allows users to select a delimiter from the drop-down list for the fields.</li></ul></td><td><ul><li><em>Record Delimiter</em> – Allows users to specify any delimiter for the records within fields.</li><li><em>Encoding box</em> – Allows users to choose the encoding scheme for the csv file from a list of choices. The default value is <em>Unicode (UTF-8)</em>.</li></ul></td></tr><tr><td><ul><li><em>Text Qualifier</em> – A symbol that identifies where text begins and ends. It is used specifically when importing data rather than exporting.</li><li><em>Apply Text Qualifier to All Fields</em> – Adds the specified qualifier to all the incoming fields.</li><li><em>Null Text</em> – Directs Astera to replace a certain value in the report model with a null value.</li><li><em>Append to File(If Exists)</em> – Adds the exported data to an existing CSV file without overwriting the data it contains.</li></ul></td><td></td><td></td></tr><tr><td><ul><li><em>Hierarchical Destination</em> – Sorts the incoming data into hierarchies where necessary.</li><li><em>Write to Multiple Files</em> – Saves the exported data to multiple files instead of one single file.</li><li><em>Rules for filtering data</em> – Specifies a criterion to export only filtered records to a CSV file. Upon expanding, users can see an expression box with built-in functions to facilitate a rule-based filtering. This feature is explained in detailed in the next section.</li></ul></td><td></td><td></td></tr></tbody></table>

3. Click *Next*. This is the *Layout Builder* screen where the extracted data fields can be modified as per the requirements.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F78fHbaUsOAlz4TqHRn9y%2F12-layout-builder.png?alt=media\&token=9cf91e13-541a-44ca-ba1a-ae444efad9a8)

4. Click *OK*, this starts the export of data. View its job trace in the *Job Progress* window. At the end of a successful run, Astera will generate the CSV file and provide its clickable link in the job trace.

![](https://docs.astera.com/projects/reportminer/en/10/_images/13-job-progress-csv.png)

The export to a CSV file is complete.

### Exporting to Database Table

1. Select the *Create New Export Settings and Run (to Database)* icon placed in the toolbar under the Model Layout panel.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fgw6QPmgKJYbhDBQ99eW0%2F14-databse.png?alt=media\&token=bd382323-8eeb-4a86-9966-9c7971a1cf45)

A configuration window will open. The first screen is the *Database Connection* screen. If a connection has been recently set up, access its configuration settings through the *Recently Used* option.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F96hWeSsB8lqR3jSEpS71%2F15-database-connection-screen.png?alt=media\&token=4c1db32e-8c83-4d0d-819f-254b4dde856d)

2. Select the required *Data Provider* from the drop-down list. In this example, we are exporting data to a *SQL Server* database table.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FYwfG4ya3nDuI2D2WL0mh%2F16-sql-server.png?alt=media\&token=e8fec03d-68c2-4711-a2b0-f5ba813932ee)

3. Establish a connection with the database by filling in all the necessary details.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FVwwFi8HofFgioZzhPlMh%2F17-credentials.png?alt=media\&token=4814068b-1344-45a6-9b2d-88f426b72ea8)

Click the *Test Connection* button and Astera will notify the user upon successful connection.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FWqEESbt2U8doI7PffIq6%2F18-test-completed.png?alt=media\&token=6b4bd2a1-aaf8-4e9b-9321-7be95e877195)

4. Click *Next*. On this screen, either pick an existing table or create a new table for export data. In this example, we have created a new table called *Invoice\_FurnitureMart*.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FxpWJEbnr6CPqosscoDVU%2F19-create-table.png?alt=media\&token=16e75264-ebcc-4432-a437-857b448a319d)

Once a database table has been specified, move onto the other options to configure the database table as per your requirements.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FTtiaB1MJnF1QDt7OIaDJ%2F20-ports-for-mapping.png?alt=media\&token=8b52c9b8-a3bc-4fa4-a9b4-6c01bc98758e)

* *Define Input Ports for Mapping* – Defines a writing strategy to the database table for each record. For example, if the data is being exported to an existing database table then users can also enable update and upsert options for each record.
* *Database Options* – Deals with system generated keys and null values.
* *Data Load Options* – Specifies the type of insert of your records into a destination database. Records can be inserted in a bulk or each record at a time.

5. Click *Next*. This is the *Layout Builder* screen where the extracted data fields can be modified as per the requirements.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FLgG8KYHIDHYVESSdinpf%2F21_layout_builder.PNG?alt=media\&token=501a75e5-c248-448c-96e2-851a08d33399)

6. Click *OK*, this starts the export of data. View its job trace in the *Job Progress* window.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FbNaYMfetCM9Kq7lprcX1%2F22-db-job-progress.png?alt=media\&token=27c039fe-5bae-4ba0-838b-c17b55b51e98)

The export to a SQL Server database table is complete.

#### Rule-Based Filtered Export

Astera enables users to specify a criterion to export only filtered records to the destination file. This option is available when data is exported to an Excel sheet or a CSV file.

1. Select the export destination of your choice. In this example, data in a report model is being exported to an excel sheet. On its configuration window, after specifying the properties, expand *Rule for Filtering Data*.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FMO9DuddHAXZwzVNTvOkj%2F23-rules-filtering-data.png?alt=media\&token=e5ad1e99-a882-4e1b-8c07-ab75d1c2a376)

Upon expanding, users can see an expression box with built-in functions to facilitate a rule-based filtering. Expand the *Order\_8* node to access the fields of the extracted data.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FefcsOAPpPzGsE6S7JlB6%2F24-rules.png?alt=media\&token=430a940d-5796-4d38-98d0-6b1c9bc6e831)

Now, we only want to export data that contains *SOFA* in the Items field. For that we have to specify an expression in the expression builder.

2. In the expression builder, write *Contains(”SOFA”,Items)*. Click the *Compile* button to verify whether the expression is successful or not.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F1Y8SSuYIGhjwfffbxJXj%2F25-expression.png?alt=media\&token=ec4c4cf5-9b22-4d6b-ac3d-c6e0ad1d4871)

Click *OK* to close the export settings window.

3. Now, click the *Run Selected Export* icon placed in the toolbar under the *Data Export Settings* panel.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F9Q0BYZiOyK55VS0fN0QC%2F26-run-selected-export.png?alt=media\&token=44fdc3b5-db4c-4a8a-b5aa-7a6826287084)

Export will begin. Observe its trace in the *Job Progress* window.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F7J6lMhPgldKG9hdi91uC%2F27-job-progress-rule-based.png?alt=media\&token=b18b1ad0-cda7-480c-877e-ad2a1b2e63ef)

At the end of a successful export, Astera will generate the Excel file with filtered records and provide its clickable link in the job trace.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F8Je37MwAiLEgtZrVMVz6%2F28-destination-file.png?alt=media\&token=35876afd-5f8f-4387-93a5-921fa8dd0305)

This completes rule-based filtered export.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.astera.com/astera-data-stack-v10/report-model/exporting-options/exporting-a-report-model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
