# textxport

(plugins.textxport)

## Overview

The `TextXport` plugin provides functionality for exporting data from a foundset into text-based formats like `.tab` or `.csv`, enabling flexible data management. Exports can be customized with separators and headers depending on requirements.

TextXport supports two main approaches for exporting data. The `createExporter` method allows for setting up complex export configurations, while `textExport` methods provide simpler, direct options for exporting with various levels of customization.

The `createExporter` method generates an export setup for a specified foundset, allowing configuration of the data separator and the inclusion of headers. This is useful for more advanced export workflows. The `textExport` methods perform direct exports to text-separated formats, such as tab-separated or comma-separated values. These methods allow specifying the foundset, data providers, separator, and header options to customize the exported output.

## **Returned Types**

[TabExporter](/reference/servoyextensions/server-plugins/textxport/tabexporter.md),[DataProviderExport](/reference/servoyextensions/server-plugins/textxport/dataproviderexport.md),

## Properties Summarized

| Type | Name | Summary |
| ---- | ---- | ------- |

## Methods Summarized

| Type                                                                               | Name                                                                                                                          | Summary                                    |
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| [TabExporter](/reference/servoyextensions/server-plugins/textxport/tabexporter.md) | [createExporter(foundSet, separator, exportHeader)](#createexporter-foundset-separator-exportheader)                          | Create exporter for easier export set up.  |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                           | [textExport(foundSet, dataProviderIds)](#textexport-foundset-dataproviderids)                                                 | Export to text 'separated value' data (\*. |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                           | [textExport(foundSet, dataProviderIds, separator)](#textexport-foundset-dataproviderids-separator)                            | Export to text 'separated value' data (\*. |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                           | [textExport(foundSet, dataProviderIds, separator, exportHeader)](#textexport-foundset-dataproviderids-separator-exportheader) | Export to text 'separated value' data (\*. |

## Properties Detailed

## Methods Detailed

### createExporter(foundSet, separator, exportHeader)

Create exporter for easier export set up. Can either use this method (for more complex exports) or textExport(...) API

**Parameters**

* [JSFoundSet](/reference/servoycore/dev-api/database-manager/jsfoundset.md) **foundSet** the foundset to export with
* [String](/reference/servoycore/dev-api/js-lib/string.md) **separator** the separator of the data
* [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) **exportHeader** export a header

**Returns:** [TabExporter](/reference/servoyextensions/server-plugins/textxport/tabexporter.md) A TabExporter object for easier export setup.

**Sample**

```js
//export with ';' separator and no header
var exporter = plugins.textxport.createExporter(forms.form1.foundset,';',false);
```

### textExport(foundSet, dataProviderIds)

Export to text 'separated value' data (\*.tab/\*.csv)

**Parameters**

* [JSFoundSet](/reference/servoycore/dev-api/database-manager/jsfoundset.md) **foundSet** the foundset to export with
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **dataProviderIds** the ids of the dataproviders

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A String containing the exported text data with default separator (tab) and no header.

**Sample**

```js
//export with default separator(tab) and no header
var dataToBeWritten = plugins.textxport.textExport(forms.form1.foundset,['id','name']);
```

### textExport(foundSet, dataProviderIds, separator)

Export to text 'separated value' data (\*.tab/\*.csv)

**Parameters**

* [JSFoundSet](/reference/servoycore/dev-api/database-manager/jsfoundset.md) **foundSet** the foundset to export with
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **dataProviderIds** the ids of the dataproviders
* [String](/reference/servoycore/dev-api/js-lib/string.md) **separator** the separator of the data

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A string containing the exported data in the specified text-separated format.

**Sample**

```js
//export with ';' separator and no header
var dataToBeWritten = plugins.textxport.textExport(forms.form1.foundset,['id','name'],';');
```

### textExport(foundSet, dataProviderIds, separator, exportHeader)

Export to text 'separated value' data (\*.tab/\*.csv)

**Parameters**

* [JSFoundSet](/reference/servoycore/dev-api/database-manager/jsfoundset.md) **foundSet** the foundset to export with
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **dataProviderIds** the ids of the dataproviders
* [String](/reference/servoycore/dev-api/js-lib/string.md) **separator** the separator of the data
* [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) **exportHeader** true for exporting with the table header, false for not

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) A String containing the exported text data with the specified separator and header (if exportHeader is true).

**Sample**

```js
//export with ';' separator and header
var dataToBeWritten = plugins.textxport.textExport(forms.form1.foundset,['id','name'],';',true);
```

***


---

# 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://docs.servoy.com/reference/servoyextensions/server-plugins/textxport.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.
