---
url: >-
  /statelake/administering-statelake/designer/data-definitions/file-definitions/flat-file-definitions/design-flat-file-definitions/file-dataview-fields-tab-flat-file-definitions.md
---

# File Dataview - Fields Tab - Flat File Definitions

All **Records** and **Fields** for a **Flat File** are entered manually.

The **Fields** tab window is split into two panes. The upper display pane **Fields** shows the fields as they are created, while the fields themselves are created in the lower pane, **Field Details**.

Click either the **Add Field** button or **Add In-Memory** Field button to add a field.

When all fields have been added as required, click on **OK** to **Save** and return to the designer canvas.

## Field Details Buttons

| Button Name | Description |
|---|---|
| Field Details *Add Field* | Click the **Add Field** icon to create a field. Once this button icon has been activated, the fields in the lower pane are able to be populated. |
| *Save Changes* | Click to **Save** the field and display the details in the upper pane. |
| *Add In-Memory Field* | Click to **Add In-Memory Field**. These fields are additional fields that are available in memory only while the dataview is active. As soon as the dataview is closed, these temporary fields no longer exist. |
| *Cancel Changes* | Click to **Cancel** the current field input mode, and no not save any changes. |

## Fields

| Field Name | Description |
|---|---|
| Field Details  *Field Name* | The **Name** of the field. A space in the **Name** is automatically interpreted as an underscore ( \_ ). |
| *Data Type* | Select a data type for the field from the drop-down list, such as **string** or **integer**. |
| *Field Size* | The maximum size of the field. This will only appear and be available in certain circumstances. |
| *Display Format* | This field is dependent on the **Data Type** selected. It will not be available for **string** or **Largeint** fields. |
| *Default Value* | Enter the value to be used as a default for the field. |
| Fields  *In-Memory* | The default for fields entered manually is False.However, this displays as **True** if the field has been created by clicking the **Add In-Memory Field** button. |

## Buttons

| Button Name | Description |
|---|---|
| OK | Click to save any changes you have made. All changes will be lost if you do not click the **OK** button. |
| Cancel | Click to **Cancel** any changes you have made. |

::: info
If you have specified a **Record ID** on the **Records** tab, then the first field to be created is one to accommodate this **Record ID** value.

It does not matter what you call it - in this example for the dataview **NEIGHBOURS**, the field is called **IDENTIFIER**, but could be given any name that makes it relevant to you.

As the **Record ID** on the **Records** tab was the value **X**, this has also been entered as the **Default Value** for this field, as shown below.

For the next dataview called **FRIENDS**, where the **Record ID** on the **Records** tab was the value **B**, this has also been entered as the **Default Value** for the **IDENTIFIER** field for this dataview, as shown below.

In the **Flat File**, the fields are separated and identifed as illustrated below - showing the **IDENTIFIER** as the first item on each line.

The lines in the **Flat File** follow a hierarchy - the **B** line records belong solely to the **X** header record above it, regardless of what may be on the line.

In the following examples, eight (8) fields have been created for the **NEIGHBOURS** record.

::: warning
For fields with a **Boolean** data type, the **Display Format** field will default to **0;1**. As the first value is taken for **True**, this means that a **True** value will return a zero (**0**) and not a one (**1**).

So in this example, for the field **XMAS_BBQ**, a **True** value will return zero (**0**). The field default is negative.

But a **True** value for the field PET?, will return a **Y**. The field default is negative.

And a **True** value for the field **ANY_CHILDREN** will result in a returned value of **sixty** (**60**). A **False**  will return everything to the right of the first semi-colon ( ; ) - the value **45;88.73 WHATEVER**.
:::

To edit an existing field, click on the field and the details will populate the lower pane. Change the details as required and click **Save** to re-save the record with your changes. To discard any changes, select **Cancel**.

New fields will automatically be appended to the bottom of the **Fields** list. While **Statelake** does not care what order the fields are in, you may want to change the order to make the list easier to read or follow. To change this order, click on the field to be moved, such as **NUM_KIDS** in the example below.

Once the field has been highlighted, click either of the up and down arrows shown on the right margin to move your selected field.

*NUM_KIDS before moving*

*NUM_KIDS after moving*
