Skip to content

Commit d24c889

Browse files
committed
docs(api): name fields[].currencyField and the record-currency aggregate refusal
Claude-Session: https://claude.ai/code/session_01Utp6Ca8jzC2P7EAQvqjNBb Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3eaecb2 commit d24c889

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎content/docs/api/data-api.mdx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ is executed. `POST /analytics/sql` refuses the same keys. To order by a member,
474474
<Callout type="info">
475475
**`fields[]` is the resolved presentation surface — read it first.** Each entry carries
476476
`name` and `type` and, when the producer declares them, `label`, `format`, `currency`,
477-
`percentScale`, `builtinAggregate`, `aggregate`, `nullLabel` and `polarity` (which direction
477+
`currencyField`, `percentScale`, `builtinAggregate`, `aggregate`, `nullLabel` and `polarity` (which direction
478478
of a measure's change is good news, relayed from the dataset measure): the optional members
479479
`AnalyticsResultResponseSchema` declares (`packages/spec/src/api/analytics.zod.ts`),
480480
mirrored member for member by `IAnalyticsService.query`'s `AnalyticsResult` and bound to
@@ -500,6 +500,13 @@ tenant default currency (the `localization.currency` setting), if one is set. A
500500
so its column shows the tenant default. The cube query on this page carries no column
501501
`currency`.
502502

503+
A measure column over a `currencyMode: 'record'` amount has one currency per row, so it
504+
carries `currencyField` instead of `currency`: the name of the dimension column, in the same
505+
answer, that groups by the amount's code field (`currencyConfig.currencyField`). Each row's
506+
currency is that row's value of that column. A `sum`, `avg`, `min` or `max` over such an
507+
amount is refused `INVALID_FIELD` / 400 unless the query groups by the code field, on the
508+
dataset query and the cube query alike; a `count` is served.
509+
503510
The dataset query also states each measure column's `aggregate` (`count`, `sum`, `avg`,
504511
`min`, `max`, `count_distinct`), whether or not the author labelled the measure, so a
505512
chart can tell a count from a sum. `builtinAggregate` is narrower: it is present only

0 commit comments

Comments
 (0)