Skip to content

Allow formulas to aggregate across linked tables without intermediate lookup/rollup fields #2900

@constantvis

Description

@constantvis

Problem

Getting a single computed value from a related table currently requires creating 3-5 intermediate fields across multiple tables.

Example: I need "VAT Rate" on my Transactions table, sourced from a Tax Rules table linked via Counterparties.

Tax Rules:        VAT Rate % (number)
Counterparties:   _VAT Rate [Tax Rules] (lookup)       ← intermediate #1
Transactions:     _VAT Ref (lookup)                     ← intermediate #2
                  VAT (manual override)
                  VAT MASTER (formula): IF(VAT, VAT, _VAT Ref)

3 extra fields across 2 tables for one value. In a real system with 15 tables this creates massive field bloat.

What I'd like

1. Formula-level multi-hop lookup

Let formulas traverse link chains directly:

LOOKUP({Counterparties}.{Tax Rules}.{VAT Rate})

Instead of creating a lookup field on every intermediate table.

2. Type coercion for lookups

Currently a formula field cannot be looked up because of strict type matching (formula ≠ number). This forces creating redundant helper fields. If formula fields were treated as their output type in lookups, most rollup fields would become unnecessary.

3. Full aggregation parity on lookups

SUM({lookupField}) works in formulas (confirmed in e2e tests). But MAX() on a date lookup returns 500. All aggregation functions should work on all lookup types.

Real-world impact

My financial system (16K transactions, 15 linked tables) currently has:

  • 14 rollup fields (11 exist only because formula→lookup type mismatch)
  • 8 intermediate lookup fields for 2-hop chains
  • ~25 helper fields total

With these improvements, ~15-18 helper fields could be eliminated.

Technical context

The foundation already exists in the codebase:

  • SUM({lookupField}) works (formula-lookup-sum-regression.e2e-spec.ts:56)
  • Conditional lookups support filter/sort/limit (lookup-options-base.schema.ts:46)
  • Nested lookup chains are tested (nested-lookup-formula.e2e-spec.ts:27)

This request is about exposing these capabilities more directly in the formula language.

Environment

Teable CE, self-hosted, 15 tables, 300+ fields, 16K+ records.

Labels: enhancement, formula, lookup


Пости на https://github.com/teableio/teable/issues/new

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions