Skip to content

Analytics: preserve raw dimension values so report drill-down can filter lookup/select dims precisely #1750

Description

@os-zhuang

Context

ADR-0021 report drill-down shipped in objectui#1649: clicking an aggregated row/cell in a dataset-bound report navigates to the object list scoped by the clicked dimension bucket (?filter[field]=value).

The analytics service (packages/services/service-analytics/src/dimension-labels.ts) resolves dimension bucket values to display labels in place (select option label, lookup record name) — resolveDimensionLabels overwrites row[dimension.name] with the human label. This is correct for rendering, but it means the raw stored value is lost by the time a drill click happens.

objectui's drill handler (ReportView.handleDatasetDrill) currently works around this per field kind:

  • select — reverse-maps the label back to the stored option value via the object's field options. Works, but fragile (depends on objectui re-deriving the mapping).
  • lookup / master_detail — the resolved label is a record name, not the FK id; objectui skips the dimension entirely, so the drill lands on a superset (all records, not the clicked account/owner).
  • date-granularity — see sibling issue.

Proposal

Have the analytics response carry the raw grouped value alongside the display label, e.g. a parallel __raw map or { value, label } cells, so the dataset query result is self-describing. Then the drill consumer can filter on the exact stored value (FK id, option value) without re-deriving anything — and lookup drill-down becomes precise instead of a superset.

Affected

  • framework: packages/services/service-analytics/src/{analytics-service,dimension-labels}.ts
  • objectui (consumer): packages/app-shell/src/views/ReportView.tsxhandleDatasetDrill — drop the label→value reverse-map once raw values arrive.

Found during the ADR-0021 report epic; browser-verified the select-field workaround against app-showcase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions