Group and total a register's rows.
The Portal's chart data over the register rows the caller can read: filter (eq, neq, gt, lt, gte, lte, between, in, contains; the values today, now, yesterday, tomorrow, this_week_start, this_month_start and this_year_start stand for dates), group by any number of fields, take metrics (count, sum, avg, min, max over a field), order and limit. Each answer group holds its value of every group_by field (by custom_field_id) and every metric (by name). owner narrows the rows to one document's.
| |
|---|
| Scope | registers:read |
| Asynchronous | No |
| MCP tool | aggregate_custom_field_template_rows |
| Portal permissions | view_custom_field_values |
Parameters
| Name | In | Type | Required | Description |
|---|
custom_field_template_id | path | string | Required | |
Docwize-Version | header | string (date) | Optional | |
Request body
Responses
Errors
The problem codes this operation can answer with. Each code links to its page.
Schemas
| Field | Type | Required | Description |
|---|
custom_field_id | string | Required | |
operator | string | Required | eq, neq, gt, lt, gte, lte, between, in or contains. |
value | string or null | Optional | The value to compare with, as text: a number as decimal text, a date as YYYY-MM-DD (or today, now, yesterday, tomorrow, this_week_start, this_month_start, this_year_start). For every operator except in and between. |
values | array of string | Optional | The values for in (one or more) and between (exactly two: from, to), as value gives them. |
RegisterAggregateGroup
| Field | Type | Required | Description |
|---|
group | object | Required | The group's value of each group_by field, keyed by the field's custom_field_id; null for rows with no value. Decimals are text, dates ISO text. |
values | object | Required | The group's metrics, keyed by the metric's name. count is a number; the others are decimal text, or null when the group has no value. |
| Field | Type | Required | Description |
|---|
filters | array of RegisterAggregateFilterInput | Optional | Conditions every row must meet (all of them). |
group_by | array of string | Optional | The fields the rows are grouped by, in this order; none gives one group of every row. |
limit | integer or null | Optional | The most groups to answer; all of them when absent. has_more says whether more existed. |
metrics | array of RegisterAggregateMetricInput | Optional | What to total in each group; a count by default. |
order_by | array of RegisterAggregateOrderInput | Optional | The order of the groups. |
owner | RowOwnerWriteInput or null | Optional | Only the rows of this document (type document); you must be able to read it. |
| Field | Type | Required | Description |
|---|
custom_field_id | string or null | Optional | The field the function is taken over: required except for count, which counts the group's rows (with a field, the rows that have a value in it). sum and avg need a numeric field. |
function | string | Required | count, sum, avg, min or max. |
name | string or null | Optional | The key the answer holds this metric's value under; the function's name by default. Names are unique in a request. |
| Field | Type | Required | Description |
|---|
custom_field_id | string or null | Optional | A field named in group_by. |
direction | string or null | Optional | asc (the default) or desc. |
metric | string or null | Optional | The name of a metric. Exactly one of metric and custom_field_id. |
RegisterAggregateResult
| Field | Type | Required | Description |
|---|
groups | array of RegisterAggregateGroup | Required | |
has_more | boolean | Required | Whether more groups existed beyond the limit. |
| Field | Type | Required | Description |
|---|
document_id | string or null | Optional | The document's ID, for type document. |
type | string | Required | document (the only owner a row write takes). |