ROOM64 / KNOWLEDGE / NOCODB

Get Select Options

Extract and display all available options from Single Select or Multiple Select fields in various formats

อ่านต้นฉบับที่ NocoDB Official Docs ↗
เอกสารอ้างอิงภาษาอังกฤษเนื้อหาจากเอกสาร NocoDB คงรายละเอียดและโค้ดตามต้นฉบับ · ต้นฉบับอัปเดต 2026-08-17 ชื่อเมนูและฟีเจอร์ที่ใช้ได้ขึ้นอยู่กับเวอร์ชันและรุ่นที่ทีมใช้งาน

Workflows · ระบบอัตโนมัติและ Scripts · Get Select Options

← Examples

สารบัญในหน้านี้

Extract and display all available options from Single Select or Multiple Select fields in various formats

This script allows you to extract and display all available options from Single Select or Multiple Select fields in your NocoDB database. You can choose to output the options in a simple list, a table format, or as a comma-separated string, making it easy to reference or export the data.

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 for field references
  • Data Analysis : Export option lists for external analysis or reporting
  • Field Auditing : Review all configured options in selection fields
  • Integration Setup : Get option lists for API integrations or data mapping
  • User Training : Generate option references for user guides and training materials

Output Formats

The script offers three different output formats to suit your needs:

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 : Choose a Single Select or Multiple Select field
  2. Choose Format : Pick your preferred output format (List, Table, or Comma-separated)
  3. Generate Output : The script displays all available options in the selected format
  4. Copy/Export : Use the formatted output for your intended purpose

Requirements

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

Supported Field Types

  • Single Select : Fields where users can choose one option from a predefined list
  • Multiple Select : Fields where users can choose multiple 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 : Instantly see all available options for any selection field
  • Multiple Formats : Choose the output format that best fits your needs
  • Documentation Ready : Generate properly formatted lists for documentation
  • Integration Friendly : Export options in formats suitable for external tools
  • No Manual Copying : Avoid manually transcribing long option lists

  • API Reference Manual Examples : Browse categorized examples from the NocoDB API reference documentation to quickly access common scripting tasks and operations.
  • Find and Replace : Search and replace text patterns across records in any text-based field with preview and confirmation
  • Convert Attachments to URLs : Convert attachment fields into comma-separated URL lists for integration with external services
  • Randomize Values : Generate random data for empty fields across multiple data types with customizable ranges and constraints
  • Validate Emails : Identify and list all invalid email addresses in email fields for data quality assurance
  • Save View Ordering to Field : Preserve manual record ordering from any view by saving it as sequential numbers in a numeric field
  • Link Records by Field : Link records between two tables using matching field values, with pagination and summary reporting.
  • Unique Field Values Summary : View unique values and their frequencies in any field, with summary and table output
เนื้อหาเอกสารอ้างอิงและภาพประกอบมาจาก NocoDB Official Docs · บทความแนะนำภาษาไทยเรียบเรียงโดย Room64 · เว็บไซต์นี้เป็นคู่มือประกอบการใช้งานโดย Room64 · เอกสารทางการ ↗

มีงานที่อยากให้ Software, AI หรือ Automation ช่วยอยู่ไหม?

เล่า workflow หรือปัญหาที่ทีมกำลังเจอ เราช่วยดูได้ว่าควรใช้ระบบสำเร็จรูป เชื่อมเครื่องมือเดิม หรือพัฒนาเพิ่มเฉพาะส่วนไหน

คุยกับเราทาง LINEhello@room64.net