Back to Nocobase

Fields

docs/docs/en/data-sources/data-modeling/collection-fields/index.md

2.1.284.3 KB
Original Source

Fields

Introduction

In NocoBase, a Field is a business attribute in a Collection. It describes the information that can be stored in a record and how that information is entered, displayed, filtered, and used in business logic.

DefinitionDescription
Data it storesFor example, text, numbers, dates, files, statuses, relations, or JSON.
How pages use itFor example, Input, DatePicker, Select, attachment upload, or a relation selector for data entry and display.
How it participates in business capabilitiesFields are used by blocks, filters, sorting, permissions, workflows, APIs, and data import and export.

A Field can correspond to:

  • An actual database column in the main database
  • An existing database column in an external database
  • A field in a database view
  • A field returned by an SQL query
  • A field in a REST API response
  • A relation field, system field, or virtual field in a collection

Think of a Field as one attribute of a business object. For example:

Business objectFields
CustomerCustomer name, mobile number, customer level, and owner
OrderOrder number, order amount, order status, and customer
ContractContract name, signing date, contract attachments, and approval status
TaskTask title, due date, priority, and assignee
FileFile name, size, MIME type, and URL

Use cases

The following field categories help you decide which kind of field to choose. Open the relevant field documentation for configuration, type mapping, and cautions.

Field categoryUse cases
Text fieldsStore names, numbers, descriptions, contact information, links, and similar content.
Rich text fieldsStore longer content such as article bodies, documentation, processing plans, and code snippets.
Number fieldsStore quantities, amounts, scores, percentages, and other numerical values.
Date and time fieldsStore timestamps, dates, times, and timestamps from external systems.
Status and option fieldsStore values from a fixed range, such as enabled state, order status, customer level, and customer tags.
Attachment fieldsUpload files or store external-file addresses.
Relation fieldsExpress connections between collections, such as an order belonging to a customer, a customer having orders, or a user being related to roles.
Identifier and code fieldsStore internal primary keys, synchronized external IDs, public-access identifiers, and business codes.
Geometric fieldsStore spatial or geographic information, such as store locations, delivery routes, and service areas.
System fieldsStore system information maintained by NocoBase or the database, such as IDs, creation time, creator, and update time.
Other fieldsHandle field needs that do not directly belong to other categories, such as sorting, formulas, and JSON.

Field interface types

NocoBase groups fields into the following categories from the Field interface perspective:

Field data types

Each Field interface has a default data type. For example, a field with the Number interface uses double by default, but it can also use float, decimal, and other data types. The currently supported data types are:

Field type mapping

The process for adding a field to a main data source is:

  1. Select a Field interface type.
  2. Configure a data type available for the selected interface.

The field-mapping process for an external data source is:

  1. Map the external database column type automatically to the corresponding Field type and UI type (Field interface).
  2. Change to a more suitable data type and interface type when needed.