# Columns

## Overview

A column is a set of data values of a particularly type, one for each row of the table. With Labii, you can customize the fields of a table with columns. Column widgets are used to specify data types.

{% embed url="<https://www.youtube.com/watch?v=g8cB8XLW7hQ&list=PLfC5DvtpQI5cZSSIHDYl6hD_XpwF9oQcX&index=14&t=2s>" %}

## List of columns

Each table has its own columns. Open a table and click the **Columns** tab to view the list of columns.

![](/files/9B72oxXDfmX0tNRQ9EYS)

### Search columns

You can search columns by typing a keyword into the search bar in the **columns list view**, and then clicking **Search**. The search results can always be cleared by clicking the **Clear** button.

### Filter columns

With the **Filter** function, you can limit the number of columns displayed. You can do that by clicking **Active columns** and then selecting a filter from the dropdown. Here are a list of filters:

* **All columns**. Filter to display all columns of the table.
* **Active columns**. Filter to display the active columns.
* **Archived columns**. Filter to display the archived columns.
* **Required columns**. Filter to display a list of required columns.
* **Optional columns**. Filter to display a list of optional columns.
* **Hidden columns**. Filter to display a list of columns that are hidden at the list view.
* **Visible columns**. Filter to display a list of columns that are visible at the list view.

## Column detail

Click a column name to see full detail of a column.

### Column fields

* **Name** - The name of the column
* **Description** - Provide a description of the column and all other necessary information to help others in the same organization to fill out
* **Order** - required field; the order to display the column, numbers only

#### Configuration

* **Widget** - The widget to use, or the type of data; tons of widgets to choose from via dropdown list and the widget store via Labii ELN & LIMS
* **Configuration** - The configuration of the column. Use it to provide additional parameters to the column.
* **Default Data** - The default data of the column.
  * For Boolean field, the default value is 'false' if not provided. Use 1 for 'true' and 0 for 'false'
  * For Select/MultiSelect field, add one item per line as options. Use '\_' to separate the value and label
  * For ForeignKey, add the unique code of the table to match. Use ',' to separate multiple matches. If not provided, it will match everything
  * For Date, use YYYY-MM-DD
* **Ref** - Reference identifier for matching this column in JSON templates

#### Settings

* **Is Required** - Make this field mandatory - users cannot save records without filling this column
* **Should Hide In Form View** - Hide this column entry in every row while keeping it visible in the record details. Use this to control the visibility of the column in the form view.
* **Should Hide In List View** - Hide this column from the table list view while keeping it accessible in individual records. Use this to control column display in the list view.
* **Should Disable Copying** - Prevent data from this column from being copied when duplicating records
* **Should Mask Data** - Display data as masked (e.g., "\*\*\*") to protect sensitive information while keeping it accessible to authorized users
* **Max Width** - Set maximum column width in pixels to prevent very wide columns from affecting table layout

#### Permission

* **Permission** - The column's supplementary permission settings can be utilized to offer additional control over its permissions.
  * **Limit Edit Permission to Member(s) Column** - Select a Member or Members column. Once selected, only the member from the selected column can edit this column.

#### Metadata

* **Metadata** - Store additional column configuration and custom properties in JSON format

#### Danger Zone

* **Is Archived** - Archive this column to hide it while preserving all existing data and history
* **Date Created** - Automatically captured in the background of Labii ELN & LIMS in real-time

## Add column

A column is a set of data values of a particularly simple type, one for each row of the table.

{% hint style="info" %}
Note: only administrators within an organization can "add a new column."
{% endhint %}

A new column can be added in the columns list view

1. Navigate to the columns list view (see above)
2. Click the "+" icon on the top of the navbar or click the "add column" from the sidebar

**Here are the fields to fill out on the “Add Column” form:**

* **Name** - required field, letters only for the name of a new column
* **Description** - optional field; provide a description of the column and all other necessary information to help others in the same organization to fill out.
* **Widget** - The widget to use, or the type of data. Default to Text. Check out Settings -> Widgets to install missing widgets. Check out here for a list of widgets
* **Configuration** - The configuration for the widget. The configuration is different for different widgets, please check [here](https://github.com/Labii/labii-gitbook-docs/blob/gitbook/admin-guide/tables/broken-reference/README.md) for the details. If a JSON is provided, use [python JSON format](https://www.w3schools.com/python/python_json.asp).
* **Default Value** - optional field; used to set the default value of the field
  * For the Boolean field, the default value is 'false' if not provided. Use 1 for 'true' and 0 for 'false';
  * For the Select/MultiSelect field, add one item per line as an option. Use '\_\_' to separate the value and label.
  * For ForeignKey, add the unique code of the table to match. Use ',' to separate multiple matches. If not provided, it will match everything. For example, use “EP” to only match experiments.
  * For Date, use YYYY-MM-DD.
* **Order** - required field; the order to display the column, numbers only
* **Is Required** - optional; if checked, the value of the column is required in form submitting
* **Is Hidden** - optional; if checked, the column will not display in the list view but will be available for use.
* Click submit once finished with all required and optional fields

## Add column from a template

Labii provides pre-built table templates to simplify the configuration process. These templates are continuously refined and improved over time. If a new column becomes available in a template and you’d like to add it effortlessly, you can use the “Add Column from a Template” feature. Here’s how:

1. Click the Add Column dropdown menu.
2. Select Add from a Template.
3. Choose the desired column from the list.

<figure><img src="/files/3TWkhhtd50XGnNiQWLCI" alt=""><figcaption></figcaption></figure>

## Add column via JSON

{% hint style="info" %}
This feature is designed for advanced users who need to create columns programmatically or in bulk using JSON code.
{% endhint %}

For advanced users who need more control or want to automate column creation, Labii provides the ability to add columns using JSON format. This method is particularly useful when:

* Creating multiple columns with complex configurations
* Replicating column structures across different tables
* Automating column creation through scripts
* Migrating column definitions from external systems

### Using ColumnGPT

ColumnGPT can help you generate the JSON code needed to create columns. Simply describe what type of column you want to create, and ColumnGPT will generate the appropriate JSON structure for you.

### JSON Structure

The JSON format for creating a column includes the following properties:

```json
{
  "name": "Column Name",
  "description": "Description of the column",
  "widget": "widget_name",
  "configuration": {},
  "default_value": "",
  "order": 100,
  "is_required": false,
  "is_hidden": false,
  "should_hide_in_form_view": false,
  "should_hide_in_list_view": false,
  "should_disable_copying": false,
  "should_mask_data": false,
  "max_width": null,
  "ref": "column_reference"
}
```

### Adding the Column

{% stepper %}
{% step %}
Navigate to the **Columns** tab of your table
{% endstep %}

{% step %}
Click the **Add Column** dropdown menu
{% endstep %}

{% step %}
Select **Add via JSON** from the options
{% endstep %}

{% step %}
Paste your JSON code into the editor
{% endstep %}

{% step %}
Click **Submit** to create the column
{% endstep %}
{% endstepper %}

### Example: Creating a Text Column

```json
{
  "name": "Sample ID",
  "description": "Unique identifier for the sample",
  "common": "text",
  "is_required": true
}
```

### Example: Creating a Select Column

```json
{
  "name": "Status",
  "description": "Current status of the sample",
  "common": "select",
  "configuration": [
	{"option": "Pending"},
	{"option": "Approved"},
	{"option": "Rejected"}
  ],
  "default_data": "Pending",
  "is_required": true
}
```

{% hint style="success" %}
**Tip:** Use ColumnGPT to generate complex column configurations. It can help you create the correct JSON structure with all necessary properties and widget-specific settings.
{% endhint %}

{% hint style="warning" %}
Ensure your JSON is properly formatted and all required fields are included. Invalid JSON will result in an error when attempting to create the column.
{% endhint %}

## Import columns

Multiple columns can be created simultaneously using **Import**. You can do this by clicking **Import** in the column list view.

## Export columns

You can export a list of columns by clicking **Export** button and select one option from the dropdown.


---

# 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.labii.com/admin-guide/tables/columns.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.
