Skip to content

Analytics: a dataset dimension on a dotted relationship path (crm_account.industry) renders raw stored values — the same field as a local dimension renders its option labels #5144

Description

@yinlianghui

Summary

A DatasetDimension whose field is a dotted relationship path gets no select-option resolution at all: the chart plots the raw stored values (education, finance, manufacturing). The same underlying field, reached as a local dimension on the object that owns it, resolves to its option labels (Education, Finance, Manufacturing).

Both render side by side on one dashboard, so the inconsistency is visible without leaving the screen.

Evidence

@objectstack/* 17.0.0-rc.1, fresh database, admin user. One dashboard (executive_dashboard), two widgets, both grouping on crm_account.industry:

Widget A — joined dimension → raw values

{id: 'revenue_by_industry',type: 'donut',dataset: 'opportunity_metrics',dimensions: ['account_industry'],values: ['total_amount']}

where the dataset declares

{name: 'account_industry',label: 'Account Industry',field: 'crm_account.industry',type: 'string'}

renders its legend as:

education finance healthcare manufacturing software technology

Widget B — local dimension → option labels

{id: 'accounts_by_industry',type: 'table',dataset: 'account_metrics',dimensions: ['industry'],values: ['annual_revenue_sum','account_count']}

where the dataset declares

{name: 'industry',label: 'Industry',field: 'industry',type: 'string'}

renders its rows as:

Education Energy & Utilities Finance Healthcare Logistics Manufacturing Software / SaaS Technology

Same field, same dashboard, same request. The only difference is field: 'crm_account.industry' vs field: 'industry'.

The option values on crm_account.industry are education / finance / … with labels Education / Finance / …, so widget A's output is exactly the stored column, unresolved.

Mechanism

The label resolver appears to look the select options up on the dataset's own object. For a dotted field, the options live on the related object (crm_account), the lookup misses, and the renderer falls through to the stored value. Nothing errors, so the widget just quietly displays database enum values to end users.

DatasetDimension has no key to help here — its whole surface is { name, label, field, type, dateGranularity } and type has no select member — so the dataset cannot declare "this dotted path is a picklist, resolve it against crm_account".

Why this is not a duplicate of #5076

#5076 is about analytics surfaces resolving option labels and then not applying the i18n bundle — the label is found, it is just the English one. That is widget B's behaviour.

This issue is the layer below: for a joined dimension the label is never resolved at all. Fixing #5076 alone would leave widget A still printing education, because there is no label in hand to translate.

Impact

Raw enum values reach end users on a dashboard. On a non-English deployment it is worse than English — education is neither the user's language nor a word they have ever seen in the UI, since every form and list shows the translated label.

Suggested fix

When a dimension's field is a dotted path, resolve the select options against the target object of the relationship rather than the dataset's base object, then apply the same option-label (and, per #5076, i18n bundle) resolution the local-dimension path already uses.

Related

Filed from a downstream app (hotcrm-heimao), tracked there as issue #69.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions