# Get Select Options

> Part of the NocoDB documentation (Workflows > Scripts > Examples). Index of all pages: https://nocodb.com/llms.txt. Any docs page is available as Markdown by adding `.md` to its URL.

URL: https://nocodb.com/docs/workflows/scripts/examples/select-options
Last updated: 2026-10-03

A NocoDB script that lists all options of a Single Select or Multiple Select field in one of three formats.

This script gets and shows all available options of a Single Select or Multiple Select field in your NocoDB database. You can show the options as a simple list, as a table or as a comma-separated string. You can then use the options as a reference or export them.

```javascript
const config = input.config({
  title: 'Get Single or Multiple Select Options',
  description: 'This script outputs all options for a single or multiple select field.',
  items: [
    input.config.table('sourceTable', {
      label: 'Table with the single or multiple select field'
    }),
    input.config.field('selectField', {
      label: 'Single or Multiple Select Field',
      parentTable: 'sourceTable'
    }),
    input.config.select('outputFormat', {
      label: 'Output Format',
      description: 'Choose how you want each option to be displayed.',
      options: [
        { label: 'List', value: 'list' },
        { label: 'Table', value: 'table' },
        { label: 'Comma Separated', value: 'commaSeparated' }
      ]
    })
  ]
});

// Extract configuration values
const table = config.sourceTable;
const field = config.selectField as Field;
const format = config.outputFormat;


if (![UITypes.SingleSelect, UITypes.MultiSelect].includes(field.type)) {
    throw new Error("Please select a Select Field")
}

// Get all available choices from the select field
const choices = field.options.choices;

// Output the choices based on the selected format
switch (format) {
  case 'list':
    choices.forEach(choice => {
      output.markdown(choice.title);
    });
    break;

  case 'table':
    const tableData = choices.map(choice => ({
      'Option Name': choice.title
    }));
    output.table(tableData);
    break;

  case 'commaSeparated':
    const optionNames = choices.map(choice => choice.title);
    const commaSeparatedList = optionNames.join(', ');
    output.markdown(commaSeparatedList);
    break;
}
```

### Use Cases

* **Documentation**: Create lists of all available options as field references.
* **Data Analysis**: Export option lists for external analysis or reports.
* **Field Auditing**: Review all configured options in select fields.
* **Integration Setup**: Get option lists for API integrations or data mapping.
* **User Training**: Create option references for user guides and training materials.

### Output Formats

The script has three output formats:

#### 1. List Format

```
Option 1
Option 2
Option 3
```

#### 2. Table Format

```
| Option |
|--------|
| Option 1 |
| Option 2 |
| Option 3 |
```

#### 3. Comma-Separated Format

```
Option 1, Option 2, Option 3
```

### How it Works

1. **Select Field**: Select a Single Select or Multiple Select field.
2. **Choose Format**: Select an output format (List, Table or Comma-separated).
3. **Generate Output**: The script shows all available options in the selected format.
4. **Copy/Export**: Copy or export the formatted output for your purpose.

### Requirements

* A **Single Select** or **Multiple Select** field with configured options
* The field must have at least one option

### Supported Field Types

* **Single Select**: Users select one option from a predefined list.
* **Multiple Select**: Users select one or more options from a predefined list.

### Example Scenarios

#### Single Select Field: "Status"

**Available Options**: `Active`, `Inactive`, `Pending`, `Archived`

**List Output:**

```
Active
Inactive
Pending
Archived
```

**Table Output:**

```
| Status |
|--------|
| Active |
| Inactive |
| Pending |
| Archived |
```

**Comma-Separated Output:**

```
Active, Inactive, Pending, Archived
```

### Benefits

* **Quick Reference**: See all available options of a select field at once.
* **Multiple Formats**: Select the output format that fits your needs.
* **Documentation Ready**: Get correctly formatted lists for documentation.
* **Integration Friendly**: Export options in formats that external tools can use.
* **No Manual Copying**: You do not have to copy long option lists by hand.

---

## Related pages

- [API Reference Manual Examples](https://nocodb.com/docs/workflows/scripts/examples/api-ref-manual-examples.md): An index of the NocoDB Scripts API reference examples, grouped by category, for common scripting tasks.
- [Find and Replace](https://nocodb.com/docs/workflows/scripts/examples/find-and-replace.md): A NocoDB script that finds and replaces text in any text-based field across records, with a preview and a confirmation.
- [Convert Attachments to URLs](https://nocodb.com/docs/workflows/scripts/examples/convert-attachments-to-urls.md): A NocoDB script that converts attachment fields into comma-separated lists of URLs for external services.
- [Randomize Values](https://nocodb.com/docs/workflows/scripts/examples/randomize-values.md): A NocoDB script that fills empty fields with random data, for many field types, with ranges and constraints that you set.
- [Validate Emails](https://nocodb.com/docs/workflows/scripts/examples/validate-emails.md): A NocoDB script that finds and lists all invalid email addresses in email fields to check data quality.
- [Save View Ordering to Field](https://nocodb.com/docs/workflows/scripts/examples/save-view-ordering.md): A NocoDB script that saves the record order of a view as sequential numbers in a numeric field.
- [Link Records by Field](https://nocodb.com/docs/workflows/scripts/examples/link-records-by-field.md): A NocoDB script that links records in two tables by matching field values, with pagination and a summary report.
- [Unique Field Values Summary](https://nocodb.com/docs/workflows/scripts/examples/unique-field-values-summary.md): A NocoDB script that shows the unique values in a field and how often each occurs, as a summary and a table.
