Single Value vs Multiple Values
In table field design, you may have noticed the concepts of ‘single value’ and ‘multiple values’. These describe whether a cell in a field stores a single value or a series of values (array). Each field type can exist in either single or multiple value states, and understanding these concepts is crucial for advanced usage.
Basic Concepts: Single vs Multiple Values
- Single Value: A single, definite piece of information. For example, “today’s date” or “John’s phone number”.
- Multiple Values: Array values, a series of information. For example, “all dates this month” or “all of John’s phone numbers”.
Default Single and Multiple Value States
Field Name | Description | Default State |
---|---|---|
SingleLineText | Single Line Text | Single |
LongText | Long Text | Single |
User | User | Optional* |
Attachment | Attachment | Multiple |
Checkbox | Checkbox | Single |
MultipleSelect | Multiple Select | Multiple |
SingleSelect | Single Select | Single |
Date | Date | Single |
Number | Number | Single |
Duration | Duration | Single |
Rating | Rating | Single |
Formula | Formula | Dynamic* |
Rollup | Rollup | Dynamic* |
Count | Count | Single |
Link | Link | Optional* |
CreatedTime | Created Time | Single |
LastModifiedTime | Last Modified Time | Single |
CreatedBy | Created By | Single |
LastModifiedBy | Last Modified By | Single |
AutoNumber | Auto Number | Single |
Button | Button | Single |
State Changes Due to Links and References
While most fields have their default single or multiple value states, these states can change due to linking and referencing mechanisms.
- Impact of Link Fields: If a link field is multiple-valued, all fields referenced through this link field will become multiple-valued. Example: Imagine you have a “Tasks” table and an “Employees” table. If a task can be completed by multiple employees, the link field in the “Tasks” table connecting to the “Employees” table will be multiple-valued. Consequently, any fields referenced through this link (such as employee phone numbers) will also become multiple-valued.
- Formulas and Rollups: Although they are typically single-valued, formulas can become multiple-valued when they reference multiple-value fields. Similarly, they can become multiple-valued when referenced through multiple-value link fields. Example: Suppose you have a formula field calculating each employee’s total salary. If this formula references a multiple-value salary field (e.g., salaries for different projects), the formula field will also become multiple-valued.
Examples
Understanding the distinction between single and multiple values is crucial for advanced users. It helps users understand why certain fields might contain multiple values and guides them in properly setting up and using these fields.
Employee Information and Project Tasks
Consider managing a company using Teable with two tables: Employee Information
and Project Tasks
.
- Employee Information table:
Name | Phone | Tasks | |
---|---|---|---|
John | 123456 | john@company.com | Task1, Task2 |
Mary | 789012 | mary@company.com | Task3 |
- Project Tasks table:
Task Name | Assigned To | Due Date | Progress |
---|---|---|---|
Task1 | John | 2023-11-20 | 50% |
Task2 | John | 2023-12-01 | 30% |
Task3 | Mary | 2023-11-15 | 80% |
In this example:
- The “Tasks” field in the Employee Information table is multiple-valued because one employee can be responsible for multiple tasks.
- The “Assigned To” field in the Project Tasks table is single-valued because each task is assigned to one employee.
When you create a new task in the “Project Tasks” table and assign it to an employee, that employee’s “Tasks” field automatically updates to include all tasks they’re responsible for.
Number Mini Charts
Example: You might wonder why a number field sometimes displays multiple lines or bars instead of just one. This occurs because it’s actually a multiple-value field, likely due to previous linking or referencing operations.