ObjectUIObjectUI
Fields

Summary Field

Read-only aggregation field for rollup calculations

The Summary Field component displays aggregated values from related records. This is a read-only field where the value is automatically calculated by the backend through rollup aggregations.

Count Summary

Count Of Related Records

42

Sum Summary

Sum Of Field Values

15750.50

Average Summary

Average Of Field Values

4.52

Field Schema

A summary field is authored as SummaryFieldMetadata (@object-ui/types), which is the source of truth for the key set: it extends BaseFieldMetadata with the related object, the aggregated field, the aggregation and its filter. summary_type is a closed union — 'count' | 'sum' | 'avg' | 'min' | 'max' | 'first' | 'last'.

import type { SummaryFieldMetadata } from '@object-ui/types';

const totalRevenue: SummaryFieldMetadata = {
  type: 'summary',
  name: 'total_revenue',
  label: 'Total Revenue',
  readonly: true,
  summary_object: 'opportunities',
  summary_field: 'amount',
  summary_type: 'sum',
  summary_filter: { stage: 'closed_won' },
  auto_update: true,
};

The computed value, and the className a host supplies, are not metadata keys — they are runtime widget props. See Field Widget Props.

Summary Types

  • count: Count of related records
  • sum: Sum of numeric field values
  • avg: Average of numeric field values
  • min: Minimum value in the field
  • max: Maximum value in the field

Examples

{
  type: 'summary',
  name: 'task_count',
  label: 'Open Tasks',
  summary_object: 'tasks',
  summary_field: 'id',
  summary_type: 'count'
}

Sum Amounts

{
  type: 'summary',
  name: 'total_sales',
  label: 'Total Sales',
  summary_object: 'invoices',
  summary_field: 'amount',
  summary_type: 'sum'
}

Average Value

{
  type: 'summary',
  name: 'avg_response_time',
  label: 'Avg Response Time',
  summary_object: 'support_tickets',
  summary_field: 'response_time_hours',
  summary_type: 'avg'
}

Min/Max Values

{
  type: 'summary',
  name: 'highest_bid',
  label: 'Highest Bid',
  summary_object: 'bids',
  summary_field: 'amount',
  summary_type: 'max'
}

Cell Renderer

In tables/grids, a summary value is rendered by the formula cell renderer — getCellRenderer('summary') resolves to this same component:

import { FormulaCellRenderer } from '@object-ui/fields';

// <FormulaCellRenderer value={15750.5} field={field} /> renders the computed
// value as monospace text: 15750.5
// A null or empty value renders an em-dash instead.

Backend Implementation

Summary fields are calculated through database aggregations:

// Example backend aggregation
const calculateSummary = async (config: SummaryConfig, parentId: string) => {
  const { summary_object, summary_field, summary_type } = config;
  
  switch (summary_type) {
    case 'count':
      return db.count(summary_object, { parent_id: parentId });
    
    case 'sum':
      return db.sum(summary_object, summary_field, { parent_id: parentId });
    
    case 'avg':
      return db.avg(summary_object, summary_field, { parent_id: parentId });
    
    case 'min':
      return db.min(summary_object, summary_field, { parent_id: parentId });
    
    case 'max':
      return db.max(summary_object, summary_field, { parent_id: parentId });
  }
};

Use Cases

  • Order Management: Total order value, order count
  • CRM: Number of contacts, total deal value
  • Project Management: Task count, total hours
  • Analytics: Average ratings, min/max values
  • Financial: Sum of expenses, average transaction size

On this page