Lookup field is not a specific field type. We can look up any type of field from a linked base. The type of a lookup field is determined by the original field in the linked base and has the isLookup property. Lookup fields cannot be edited.
All field return values may have isMultipleCellValue: true
in certain cases:
-
This occurs when the field is a lookup field. When the linked value allows multiple selections, the lookup field value will necessarily be an array.
-
Fields can be configured - for example, user fields and link fields can be configured as single or multiple selection. In your code, you can use field.isMultipleCellValue
to determine if a field accepts multiple values.
Do not use field type to determine write permissions. Instead, use the isComputed property of the field.
1. Number Field
- type: number
- Write type:
number
- Return type:
isMultipleCellValue: false
: number
isMultipleCellValue: true
: number[]
Example:
// Write value
42
// Return value (isMultipleCellValue: false)
42
// Return value (isMultipleCellValue: true)
[42, 17, 99]
2. Single Line Text Field
- type: singleLineText
- Write type:
string
- Return type:
isMultipleCellValue: false
: string
isMultipleCellValue: true
: string[]
Example:
// Write value
"Hello, Teable!"
// Return value (isMultipleCellValue: false)
"Hello, Teable!"
// Return value (isMultipleCellValue: true)
["Hello, Teable!", "Welcome", "Good day"]
3. Long Text Field
- type: longText
- Write type:
string
- Return type:
isMultipleCellValue: false
: string
isMultipleCellValue: true
: string[]
Example:
// Write value
"This is a long text field that can contain multiple paragraphs..."
// Return value (isMultipleCellValue: false)
"This is a long text field that can contain multiple paragraphs..."
// Return value (isMultipleCellValue: true)
["This is a long text...", "Another long text...", "Yet another long text..."]
4. Single Select Field
- type: singleSelect
- Write type:
string
(option value)
- Return type:
isMultipleCellValue: false
: string
isMultipleCellValue: true
: string[]
Example:
// Write value
"Option A"
// Return value (isMultipleCellValue: false)
"Option A"
// Return value (isMultipleCellValue: true)
["Option A", "Option B", "Option C"]
5. Multiple Select Field
- type: multipleSelect
- Write type:
string[]
(array of option values)
- Return type:
string[]
Example:
// Write value
["Red", "Blue", "Green"]
// Return value
["Red", "Blue", "Green"]
6. Link Field
- type: link
- Write type:
isMultipleCellValue: false
: { id: string }
isMultipleCellValue: true
: { id: string }[]
- Return type:
isMultipleCellValue: false
: { id: string, title?: string }
isMultipleCellValue: true
: { id: string, title?: string }[]
Example:
// Write value (isMultipleCellValue: false)
{ id: "rec123456" }
// Write value (isMultipleCellValue: true)
[{ id: "rec123456" }, { id: "rec789012" }]
// Return value (isMultipleCellValue: false)
{ id: "rec123456", title: "Related Record 1" }
// Return value (isMultipleCellValue: true)
[
{ id: "rec123456", title: "Related Record 1" },
{ id: "rec789012", title: "Related Record 2" }
]
- type: formula
- Write type: Cannot be written directly
- Return type: Depends on formula result, can be
string | number | boolean
or their array forms
Example:
// Return value (isMultipleCellValue: false)
42 // or "Result" or true
// Return value (isMultipleCellValue: true)
[42, 17, 99] // or ["Result1", "Result2"] or [true, false, true]
8. Attachment Field
To upload an attachment to an attachment field, use the dedicated API. For details, see the Upload Attachment section.
-
type: attachment
-
Write type:
{
id: string;
name: string;
path: string;
token: string; // Unique identifier
size: number; // File size in bytes
mimetype: string; // File type
presignedUrl?: string; // File preview/download URL
width?: number; // Image width
height?: number; // Image height
}[]
-
Return type:
{
id: string;
name: string;
path: string;
token: string; // Unique identifier
size: number; // File size in bytes
mimetype: string; // File type
presignedUrl?: string; // File preview/download URL
width?: number; // Image width
height?: number; // Image height
}[]
Example:
// Write value
[
{
name: "document.pdf",
type: "application/pdf",
token: "abc123",
size: 1024000
}
]
// Return value
[
{
id: "att123",
name: "document.pdf",
path: "/uploads/document.pdf",
token: "abc123",
size: 1024000,
mimetype: "application/pdf",
presignedUrl: "https://app.teable.io/preview/document.pdf",
},
{
id: "att456",
name: "image.jpg",
path: "/uploads/image.jpg",
token: "def456",
size: 2048000,
mimetype: "image/jpeg",
presignedUrl: "https://app.teable.io/preview/image.jpg",
width: 1920,
height: 1080
}
]
9. Date Field
- type: date
- Write type:
string
(ISO 8601 format)
- Return type:
isMultipleCellValue: false
: string
(ISO 8601 format)
isMultipleCellValue: true
: string[]
(ISO 8601 format)
You can use new Date().toISOString()
to get the ISO 8601 time format
Example:
// Write value
"2024-09-02T02:51:03.875Z"
// Return value (isMultipleCellValue: false)
"2024-09-02T02:51:03.875Z"
// Return value (isMultipleCellValue: true)
["2024-09-02T02:51:03.875Z", "2024-09-02T02:51:03.875Z"]
10. Created Time Field
- type: createdTime
- Write type: Cannot be written directly
- Return type:
isMultipleCellValue: false
: string
(ISO 8601 format)
isMultipleCellValue: true
: string[]
(ISO 8601 format)
Example:
// Return value (isMultipleCellValue: false)
"2024-09-02T02:51:03.875Z"
// Return value (isMultipleCellValue: true)
["2024-09-02T02:51:03.875Z", "2024-09-02T02:51:03.875Z"]
11. Last Modified Time Field
- type: lastModifiedTime
- Write type: Cannot be written directly
- Return type:
isMultipleCellValue: false
: string
(ISO 8601 format)
isMultipleCellValue: true
: string[]
(ISO 8601 format)
Example:
// Return value (isMultipleCellValue: false)
"2023-04-15T10:30:00Z"
// Return value (isMultipleCellValue: true)
["2023-04-15T10:30:00Z", "2023-04-16T14:45:00Z"]
12. Checkbox Field
- type: checkbox
- Write type:
boolean
- Return type:
isMultipleCellValue: false
: boolean
isMultipleCellValue: true
: boolean[]
Example:
// Write value
true
// Return value (isMultipleCellValue: false)
true
// Return value (isMultipleCellValue: true)
[true, false, true]
13. Rollup Field
- type: rollup
- Write type: Cannot be written directly
- Return type: Depends on rollup configuration, can be
number | string
or their array forms
Example:
// Return value (isMultipleCellValue: false)
42 // or "Summary Result"
// Return value (isMultipleCellValue: true)
[42, 17, 99] // or ["Summary 1", "Summary 2"]
14. Rating Field
- type: rating
- Write type:
number
- Return type:
isMultipleCellValue: false
: number
isMultipleCellValue: true
: number[]
Example:
// Write value
4
// Return value (isMultipleCellValue: false)
4
// Return value (isMultipleCellValue: true)
[4, 3, 5]
15. Auto Number Field
- type: autoNumber
- Write type: Cannot be written directly
- Return type:
isMultipleCellValue: false
: number
isMultipleCellValue: true
: number[]
Example:
// Return value (isMultipleCellValue: false)
42
// Return value (isMultipleCellValue: true)
[42, 43, 44]
16. User Field
- type: user
- Write type:
isMultipleCellValue: false
: { id: string, title: string }
isMultipleCellValue: true
: { id: string, title: string }[]
- Return type:
isMultipleCellValue: false
: { id: string, title: string, email?: string, avatar?: string }
isMultipleCellValue: true
: { id: string, title: string, email?: string, avatar?: string }[]
Example:
// Write value (isMultipleCellValue: false)
{ id: "user123", title: "John Doe" }
// Write value (isMultipleCellValue: true)
[
{ id: "user123", title: "John Doe" },
{ id: "user456", title: "Jane Smith" }
]
// Return value (isMultipleCellValue: false)
{
id: "user123",
title: "John Doe",
email: "john@example.com",
avatar: "https://example.com/avatar.jpg"
}
// Return value (isMultipleCellValue: true)
[
{
id: "user123",
title: "John Doe",
email: "john@example.com",
avatar: "https://example.com/avatar1.jpg"
},
{
id: "user456",
title: "Jane Smith",
email: "jane@example.com",
avatar: "https://example.com/avatar2.jpg"
}
]
17. Created By Field
- Write type: Cannot be written directly
- Return type:
isMultipleCellValue: false
: { id: string, title: string, email?: string, avatar?: string }
isMultipleCellValue: true
: { id: string, title: string, email?: string, avatar?: string }[]
Example:
// Return value (isMultipleCellValue: false)
{
id: "user123",
title: "John Doe",
email: "john@example.com",
avatar: "https://example.com/avatar.jpg"
}
// Return value (isMultipleCellValue: true)
[
{
id: "user123",
title: "John Doe",
email: "john@example.com",
avatar: "https://example.com/avatar1.jpg"
},
{
id: "user456",
title: "Jane Smith",
email: "jane@example.com",
avatar: "https://example.com/avatar2.jpg"
}
]
18. Last Modified By Field
- Write type: Cannot be written directly
- Return type:
isMultipleCellValue: false
: { id: string, title: string, email?: string, avatar?: string }
isMultipleCellValue: true
: { id: string, title: string, email?: string, avatar?: string }[]
Example:
// Return value (isMultipleCellValue: false)
{
id: "user123",
title: "John Doe",
email: "john@example.com",
avatar: "https://example.com/avatar.jpg"
}
// Return value (isMultipleCellValue: true)
[
{
id: "user123",
title: "John Doe",
email: "john@example.com",
avatar: "https://example.com/avatar1.jpg"
},
{
id: "user456",
title: "Jane Smith",
email: "jane@example.com",
avatar: "https://example.com/avatar2.jpg"
}
]