---
url: >-
  /flow/guide/administering-flow/configuring-flow/data-definitions/file-definitions.md
---

# File Definitions

File Definitions allow you to "describe" the structure of your files to the Flow application. This allows Flow to understand your particular file structure and read and write data to it. This gives you the flexibility to interact with any file as you are in complete control over the definition.

A File Definition can be used to describe Flat Files, XML Files, and EDI Files. Flat Files are any structured text file either fixed length or delimited. XML Files are any XML based file that can be described using XML Schema (XSD). EDI Files are any UN/EDIFACT or ANSI based files.

A File Definition is an in-memory representation of the data you are going to read or write from the file. When reading data the definition is opened and the data loaded from the file into memory. The data is retained in memory until the definition is closed.

When writing data the definition is opened against the database but no file is read. This provides an in-memory representation of what the data structure is. You then write data into the definition using a map, and this is subsequently output in the appropriate format to the file on the hard disk. Even after writing the data to the file, the data is retained in memory until the definition is closed. If the act of writing to the file has caused auto-generated fields to create values, these values can be returned to the in-memory dataset.

You can create a single File Definition and use it against multiple similar files simply by assigning a different File Connection. When assigning a File Connection to a File Definition it is considered a design time assignment, when coming to use the File Definition in an Action you have the chance to reassign the File Connection (run time assignment). This allows you to use the same File Definition in multiple Actions each with their own File Connection.

::: details Create a File Definition

1. Open the [Flow Designer](/flow/guide/getting-started/starting-flow)

2. Navigate to `Configuration > Components > Data Definitions > File Definitions`

3. Right click `File Definitions` and select `New`

   ![](/flow/images/file-definition-general-_542x589.jpg)

4. Fill in the details and click `Save`. See [File Definition](/flow/guide/administering-flow/configuring-flow/data-definitions/file-definitions/file-definition/)
   :::

:::: details Edit a File Definition
::: tip
A single left click on the File Definition will also open the edit window
:::

1. Open the [Flow Designer](/flow/guide/getting-started/starting-flow)
2. Navigate to `Configuration > Components > Data Definitions > File Definitions`
3. Right click the desired `File Definition` and select `Edit`
4. Change the details as required and click `Save`. See [File Definition](/flow/guide/administering-flow/configuring-flow/data-definitions/file-definitions/file-definition/)
   ::::

::: details Delete a File Definition

1. Open the [Flow Designer](/flow/guide/getting-started/starting-flow)

2. Navigate to `Configuration > Components > Data Definitions > File Definitions`

3. Right click the desired `File Definition` and select `Delete`

   ![](/flow/images/delete-file-definition.jpg)

4. Click `Yes` to confirm your choice
   :::

::: details Copy a File Definition

1. Open the [Flow Designer](/flow/guide/getting-started/starting-flow)
2. Navigate to `Configuration > Components > Data Definitions > File Definitions`
3. Right click the desired `File Definition` and select `Copy`
4. The copy of the File Definition will display in the edit window. Change the details as required and click `Save`. See [File Definition](/flow/guide/administering-flow/configuring-flow/data-definitions/file-definitions/file-definition/)
   :::

::: details Export a File Definition

1. Open the [Flow Designer](/flow/guide/getting-started/starting-flow)

2. Navigate to `Configuration > Components > Data Definitions > File Definitions`

3. Right click the desired `File Definition` and select `Export`

   ![](/flow/images/export-file-definition.jpg)

4. The template Web will be assigned a default file name consisting of the name and type of the module. Change the name if desired and click `Save`. See [Exporting and Importing](/flow/guide/administering-flow/configuring-flow/exporting-and-importing/)
   :::

:::: details Import a File Definition

1. Open the [Flow Designer](/flow/guide/getting-started/starting-flow)

2. Navigate to `Configuration > Components > Data Definitions > File Definitions`

3. Right click `File Definitions` and select `Import`

   ![](/flow/images/import-template-file.jpg)

4. Select the Template Web you wish to import and click `Open`

   ![](/flow/images/template-import-settings.jpg)

5. Choose the import method and click `OK`. See [Exporting and Importing](/flow/guide/administering-flow/configuring-flow/exporting-and-importing/) A confirmation screen will show what has been imported.

   ![](/flow/images/import-confirmation-file-definition.jpg)

::: tip
Note how dependant modules like the File Connection and DB Connection have been imported. When exporting a module that is dependant on other modules, these dependant modules are also included in the Template so that it can be recreated exactly when imported
:::
::::

::: details Change Security on File Definition

1. Open the [Flow Designer](/flow/guide/getting-started/starting-flow)
2. Navigate to `Configuration > Components > Data Definitions > File Definitions`
3. Right click the desired `File Definition` and select `Security`
4. Change the details as required and click `Save`. See [Managing Security](/flow/guide/using-flow/managing-users-and-security/managing-security)
   :::

::: details Refresh list of File Definitions

1. Open the [Flow Designer](/flow/guide/getting-started/starting-flow)
2. Navigate to `Configuration > Components > Data Definitions > File Definitions`
3. Right click `File Definitions` and select `Refresh`
   :::
