Fields
Fields are database columns with additional metadata and configuration in TrackVision AI. They represent how data is stored, displayed, and managed within collections, defining the individual data elements that structure your business information.
Overview
A field in TrackVision AI combines database schema definition with user interface configuration, providing comprehensive control over data storage, validation, presentation, and user interaction. Each field includes:
- Database column specifications and constraints
- User interface behavior and appearance
- Validation rules and data integrity checks
- Display formatting and presentation options
- Relationship definitions to other collections
Field Categories
Text Types
String
Short text data with configurable length limits and formatting options.
Use cases: Names, titles, codes, short descriptions Database type: VARCHAR Properties:
max_length: Maximum character count (default: 255)trim: Automatically remove whitespace from inputmask: Input formatting pattern for consistent data entryslug: Auto-generate URL-friendly slugs from input
Text
Long-form text content with rich formatting capabilities.
Use cases: Descriptions, articles, comments, documentation Database type: TEXT Properties:
toolbar: Rich text editor toolbar configurationfolder: File upload destination for embedded mediasanitize: HTML content sanitization rules
UUID
Universally unique identifiers, automatically generated or manually entered.
Use cases: Primary keys, external references, secure identifiers Database type: UUID Properties:
readonly: Prevent manual editing after creationhidden: Hide from user interface
Hash
Encrypted storage for sensitive data like passwords.
Use cases: Passwords, API keys, secure tokens Database type: VARCHAR Properties:
masked: Hide value in interface (show asterisks)hash: Hashing algorithm (bcrypt, argon2, sha256)
Alias
Virtual fields that don't map to database columns but provide interface functionality.
Use cases: Computed values, UI helpers, display-only information Database type: None (virtual) Properties:
interface: Custom interface for user interactiondisplay: Custom display formatting
Numeric Types
Integer
Whole numbers with range validation and display formatting.
Use cases: Counts, IDs, quantities, rankings Database type: INTEGER Properties:
min_value: Minimum allowed valuemax_value: Maximum allowed valuestep: Increment/decrement step size
Big Integer
Large whole numbers for high-volume scenarios.
Use cases: Large datasets, high-precision counts, timestamps Database type: BIGINT Properties:
min_value: Minimum allowed valuemax_value: Maximum allowed valuestep: Increment/decrement step size
Float
Decimal numbers with precision control.
Use cases: Measurements, percentages, scientific data Database type: FLOAT Properties:
min_value: Minimum allowed valuemax_value: Maximum allowed valuestep: Increment/decrement step sizeprecision: Number of decimal places
Decimal
High-precision decimal numbers for financial calculations.
Use cases: Currency, financial calculations, precise measurements Database type: DECIMAL Properties:
precision: Total number of digitsscale: Number of digits after decimal pointmin_value: Minimum allowed valuemax_value: Maximum allowed value
Boolean Type
Boolean
True/false values with customizable labels and icons.
Use cases: Flags, settings, status indicators, yes/no questions Database type: BOOLEAN Properties:
label: Custom labels for true/false statesicon_on: Icon displayed when trueicon_off: Icon displayed when false
Date and Time Types
DateTime
Date and time stamps with timezone support.
Use cases: Created/updated timestamps, event dates, scheduling Database type: TIMESTAMP Properties:
include_seconds: Show seconds in time picker24hour: Use 24-hour time formatmin: Minimum allowed date/timemax: Maximum allowed date/time
Date
Date-only values without time information.
Use cases: Birth dates, deadlines, event dates Database type: DATE Properties:
min: Minimum allowed datemax: Maximum allowed date
Time
Time-only values without date information.
Use cases: Business hours, time slots, durations Database type: TIME Properties:
include_seconds: Include seconds in time selection24hour: Use 24-hour format
Timestamp
Unix timestamp values for precise time tracking.
Use cases: System timestamps, API integrations, precise timing Database type: INTEGER Properties:
readonly: Prevent manual editingauto_update: Automatically update on record changes
Binary Types
File
File uploads with type restrictions and storage configuration.
Use cases: Documents, attachments, media files Database type: UUID (reference to files table) Properties:
folder: Upload destination folderaccept: Allowed file types (MIME types)max_size: Maximum file size in bytes
Image
Image files with transformation and optimization options.
Use cases: Photos, logos, graphics, thumbnails Database type: UUID (reference to files table) Properties:
folder: Upload destination foldercrop: Enable image cropping toolsdimension_constraints: Width/height limitsquality: JPEG compression quality
Structured Types
JSON
Structured data objects with schema validation.
Use cases: Configuration data, API responses, complex structures Database type: JSON Properties:
template: JSON schema templatevalidation: JSON schema for validation
CSV
Comma-separated values for simple lists.
Use cases: Tags, simple lists, multi-select options Database type: TEXT Properties:
delimiter: Character used to separate valuestrim: Remove whitespace from values
Geospatial Types
Geometry
Spatial data and coordinates for mapping applications.
Use cases: Locations, boundaries, geographic data Database type: GEOMETRY (requires spatial extension) Properties:
geometry_types: Allowed types (Point, LineString, Polygon)max_features: Maximum number of features
Field Configuration
Schema Configuration
Database Settings
- Field Key: Unique identifier within collection (immutable)
- Type: Database column type (immutable after creation)
- Length: Maximum data length for applicable types
- Default Value: Value assigned to new records
- Allow Null: Whether field can contain null values
Constraints
- Primary Key: Mark field as primary key
- Unique: Enforce uniqueness across collection
- Not Null: Require value for all records
- Auto Increment: Automatic number generation (integers only)
Field Configuration
Basic Properties
- Display Name: Human-readable field label
- Note: Description or help text for users
- Translation Key: Internationalization identifier
- Required: Field must have value when creating items
- Readonly: Prevent editing after initial creation
- Hidden: Hide field from user interface
Advanced Properties
- Width: Field width in forms (full, half, quarter)
- Sort: Custom ordering within field groups
- Group: Logical grouping of related fields
- Validation: Custom validation rules and messages
Interface Configuration
Interfaces define how users create, edit, and view field data:
Input Interfaces
- Input: Simple text input
- Textarea: Multi-line text input
- Wysiwyg: Rich text editor
- Code: Syntax-highlighted code editor
- Slider: Numeric range input
- Toggle: Boolean switch
- Dropdown: Select from predefined options
- Checkboxes: Multiple selection options
- Radio Buttons: Single selection from options
File Interfaces
- File: File upload and management
- Files: Multiple file upload
- Image: Image upload with preview
- Gallery: Multiple image management
Relational Interfaces
- Many-to-One: Select related record
- One-to-Many: Manage child records
- Many-to-Many: Select multiple related records
- Translations: Manage multi-language content
Display Configuration
Display options control how field values are presented:
Text Displays
- Raw: Show value as-is
- Formatted Text: Apply text formatting
- Markdown: Render markdown content
- Code: Syntax highlighting for code
Numeric Displays
- Formatted Number: Number formatting with locale
- Currency: Currency formatting
- Percentage: Percentage display
- Filesize: Byte size formatting
Date Displays
- Datetime: Full date and time formatting
- Date: Date-only formatting
- Time: Time-only formatting
- Relative Time: Time ago/from now
Media Displays
- Image: Image preview and lightbox
- File: File download link
- Video: Video player embed
Validation Configuration
Built-in Validators
- Required: Field must have value
- Unique: Value must be unique in collection
- Email: Valid email address format
- URL: Valid URL format
- Length: Minimum/maximum character count
- Range: Numeric min/max values
- Pattern: Regular expression matching
Custom Validation
Define custom validation logic:
// Custom email domain validation
function validateCompanyEmail(value) {
if (!value) return true; // Allow empty if not required
const allowedDomains = ['company.com', 'subsidiary.com'];
const domain = value.split('@')[1];
return allowedDomains.includes(domain) || 'Must use company email address';
}
Validation Messages
- Custom Messages: Override default validation messages
- Internationalization: Translated validation messages
- Dynamic Messages: Context-aware validation feedback
Conditions Configuration
Dynamic field behavior based on other field values:
Visibility Conditions
Show/hide fields based on other field values:
{
"name": "shipping_address",
"rule": {
"_and": [
{
"shipping_required": {
"_eq": true
}
}
]
}
}
Required Conditions
Make fields required based on conditions:
{
"name": "billing_address",
"rule": {
"_and": [
{
"payment_method": {
"_eq": "invoice"
}
}
]
}
}
Value Conditions
Set field values based on other fields:
{
"name": "full_name",
"rule": {
"_and": [
{
"first_name": {
"_nnull": true
}
},
{
"last_name": {
"_nnull": true
}
}
]
}
}
Field Management
Creating Fields
Fields can be created through multiple methods:
- Platform Admin Interface: Visual field builder
- REST API: Programmatic field creation
- GraphQL Schema: Schema-first development
- Database Migrations: Version-controlled changes
- Schema Import: Import from existing database
Field Updates
Safe Updates
- Adding validation rules (if data complies)
- Updating display properties
- Modifying interface configuration
- Adding help text and notes
Breaking Changes
- Changing field type
- Renaming field key
- Adding non-nullable constraints
- Removing fields with data
Field Deletion
Soft Deletion
- Hide field from interface
- Preserve data in database
- Allow restoration if needed
Hard Deletion
- Remove field from database
- Permanently delete all data
- Cannot be undone
System Fields
TrackVision AI automatically creates system fields for accountability:
Standard System Fields
id: Primary key (UUID or auto-increment)status: Publication statuscreated_at: Creation timestampupdated_at: Last modification timestampcreated_by: User who created the recordupdated_by: User who last modified the record
Archive Fields
archived: Soft deletion flagarchived_at: Archive timestamparchived_by: User who archived the record
Performance Considerations
Database Optimization
Indexing Strategy
- Primary Keys: Automatically indexed
- Foreign Keys: Automatically indexed
- Unique Fields: Automatically indexed
- Frequently Queried: Add manual indexes
- Sort Fields: Index for performance
- Filter Fields: Index common filter targets
Data Type Selection
- Storage Efficiency: Choose minimal required type
- Query Performance: Consider index-friendly types
- Application Needs: Balance storage vs. functionality
Interface Performance
Field Loading
- Lazy Loading: Load fields as needed
- Conditional Loading: Load based on user permissions
- Batch Loading: Group field requests
User Experience
- Progressive Disclosure: Show relevant fields first
- Field Grouping: Organize related fields
- Smart Defaults: Reduce user input requirements
Best Practices
Field Design
Naming Conventions
- Descriptive Names: Use clear, meaningful field names
- Consistent Patterns: Follow established naming conventions
- Snake Case: Use underscore_separated_names
- Avoid Abbreviations: Use full words when possible
- Database Reserved Words: Avoid SQL keywords
Data Types
- Appropriate Selection: Choose most specific type
- Future-Proofing: Consider data evolution needs
- Validation Rules: Implement comprehensive validation
- Default Values: Provide sensible defaults
- Nullable Strategy: Decide null handling approach
User Experience
Interface Design
- Logical Grouping: Organize related fields together
- Progressive Disclosure: Show complex fields conditionally
- Help Text: Provide clear field descriptions
- Input Validation: Real-time feedback for users
- Accessibility: Support screen readers and keyboard navigation
Performance Optimization
- Field Selection: Only load needed fields
- Conditional Loading: Load based on user context
- Caching Strategy: Cache frequently accessed data
- Pagination: Handle large datasets efficiently
- Batch Operations: Group related field operations
Data Management
Validation Strategy
- Client-Side: Immediate user feedback
- Server-Side: Authoritative validation
- Database Level: Final data integrity check
- Custom Rules: Business logic validation
- Error Handling: Graceful validation failure
Security Considerations
- Input Sanitization: Clean user input
- Output Encoding: Prevent XSS attacks
- Permission Checks: Field-level access control
- Audit Logging: Track field value changes
- Sensitive Data: Proper handling of confidential information