> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cfo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Table view grammar

> For agents: the breakdown notation that describes a Table block's rows and columns, and the typed layout fields that carry it in edit_table_blocks and Canvas datasets, with orientation rules and why a table comes back empty.

A table's view is its rows and columns. Tools take them as typed lists: each entry names one Variable, one Dimension, the Date axis at a grain, a blank row, or a fork into side-by-side branches, and a Variable entry can carry its own breakdown of Dimension levels. The same shapes have a compact written form, the breakdown notation, which the `build-model` skill uses and which reads well in an explanation. Requests always use the typed fields, never the bracket string.

## The written notation

| Form | Meaning |
| - | - |
| `[Department]` | Split by one Dimension: one row per Department item. |
| ``[`Spend Type`]`` | Backticks quote a Dimension name that is not a single word. Written bare, the parse stops at the second word. |
| `[Department, Level]` | A comma nests: Levels sit under each Department. |
| `[Department, {Level, Owner}]` | Braces fork: under each Department, a Level breakdown and an Owner breakdown sit side by side. Whatever follows the brace applies to every branch. The notation can nest a fork inside a branch; a request can save one fork per path, as `branches` below says. |
| `[Department, {Level[Department = "Engineering"], Owner}]` | A branch condition: Level sits under Engineering only, while Owner applies under every Department. A branch condition names one item of an earlier Dimension on the same path; a condition over several items is not accepted. |
| `{Level, [Owner, Date.Month]}` | A branch that nests is bracketed: Owner splits by month, while Level does not. |
| `[Region in {East, West}]` | An item filter keeps only the listed items instead of every item in the Dimension. |
| `[Date.Month]` | A grain buckets a date Dimension: Day, Week, Month, Quarter, Half, or Year. A table has one Date axis. Date levels nested from coarser to finer, such as `[Date.Year, Date.Month]`, are levels of that one axis, and a Date level nested under another Dimension, as in `{Level, [Owner, Date.Month]}`, is that axis too; a finer level above a coarser one, the same grain twice, or a Date level placed where the table already has a Date axis elsewhere, such as on the other side, starts a second axis, which is refused with **a saved table can have only one system-owned Date axis; Date levels nested from coarser to finer, such as YEAR then MONTH, are one axis**. |

In a layout, `filter` is always a list of items to keep. Ranges, exclusions, and `where` conditions go in a node's `members` instead, as a live condition string such as `Region not in {"West"}` or `` `Hiring Request` where `Hiring Request`.`Hiring Cost Centre` = "FIN - Finance" ``; the table saves the condition and checks it at every calculation, so an item that matches later joins the axis with no table edit. The same `members` on `row_updates` or `column_updates` narrows an existing axis, as [Filter the items an axis shows](https://docs.cfo.ai/agents/write-formulas.md#filter-the-items-an-axis-shows) describes.

## Table layout fields

`edit_table_blocks` `create` and `reshape` take `rows` and `columns` as lists of nodes. `structure.insert` on `update` takes one node per entry, with the `side` it joins, `rows` or `columns`, and an optional `parent`, `before`, or `after`. `inspect_table_blocks` returns the same saved shape under `layout.rows` and `layout.columns`, and `inspect_pages` `read` returns it for each Table block on a Page. A `create` accepts rows and columns copied from either read: `target`, `ref`, `display_name`, `presentation`, `details`, and `hidden_by` are ignored; a copied `formulas` group becomes the new table's default formula column; and explicit `children` on every breakdown root, `[]` included, keep the roots separate, while declarations without `children` nest consecutive levels. `property`, `preserve`, `protected`, and `clear_formula` still need an existing table.

| Node field | Meaning |
| - | - |
| `variable` | A Variable row or column, by name or reference. |
| `breakdown` | The levels nested beneath that Variable, outermost first, up to 10. Each level is a Dimension name, a level object, or a `branches` fork. |
| `dimension` | A Dimension node: a breakdown level, or the value axis of a record table. A name that matches one Dimension reuses it; an unmatched name creates it, with `items` and `data_type` when given. |
| `time` | The Date axis at `DAY`, `WEEK`, `MONTH`, `QUARTER`, `HALF`, or `YEAR`. It creates the Date Dimension when the Model has none. Two `time` entries from coarser to finer, such as `{"time": "YEAR"}` then `{"time": "MONTH"}`, nest as one axis in `create`, in a Canvas dataset, and in the layout a read returns. |
| `filter` | `{"include": [...]}`: the items of a Dimension this node declares or places that stay visible, 1 to 10,000 of them. List order does not set display order. A node takes `filter` or `members`, not both: a node that gives both with values is refused by the schema, and one that passes it is refused with **filter and members both select members; give one**. |
| `members` | The axis's item filter in the grammar `row_updates.members` takes, published once as `$defs/member_filter`: a list of item names, or a string holding a live condition the table evaluates at every calculation. A condition on a node is resolved, checked, and saved by the same step as an update's, so the saved form, the receipt's `member_filters` entry, and the refusals are the same, including the refusal of a condition that names a Variable. A condition on a level of a Variable's `breakdown` is saved on that level's axis. Giving one axis `members` both on its node and in a `row_updates` or `column_updates` entry of the same call is refused with **members for \[axis] is given on its layout node and in a row or column update; give one**. The Date axis takes no `members`, and a condition beneath a node kept as saved is refused, because that node keeps its saved children and their filters. |
| `when` | `{"dimension": ..., "equals": ...}`: a branch condition that restricts this level to one item of an ancestor Dimension on the same path. |
| `branches` | A fork: two or more sibling paths, each a list of up to 10 levels. A path from the top to the end may fork once. The saved table is counted as a read shows it: a level after the fork is saved once under every path, so a breakdown holds at most 50 Dimensions counting each level under every sibling path, at most 10 levels with the fork counted as one, and at most 10 levels in any one path counting the levels after the fork. A refusal reads, for example, **a variable's breakdown in the saved table would hold 52 dimensions, counting each level saved under every sibling path; a table read shows at most 50**. A table already over a bound keeps accepting edits that do not add to it. |
| `space` | `true`: a blank separator row on create, or a saved empty slot on reshape. Available only in `rows`. |
| `summary` | `NONE` keeps the parent's own modeled value. `SUM`, `AVG`, `MIN`, `MAX`, `COUNT`, or `LAST` combine the children instead, independently of the time rollup. |
| `sort` | The order of a grouping axis's items: `type` `AXIS_ASC` or `AXIS_DESC` by item value, or `MANUAL` with `manualOrdering` listing the leading items. With `column`, a saved value or field column named by its readable reference, `AXIS_ASC` or `AXIS_DESC` orders one Dimension row axis by that column's calculated values on every refresh, so an item that arrives later takes its place once its values are in; text sorts without regard to case, and blanks and errors sort last. The column must be a top-level value or field column of the final layout, with no breakdowns or comparisons; otherwise the write is refused, with **sort column "\[name]" does not name a top-level value or field column** or **column sorting supports one dimension row axis without breakdowns or comparisons**. A later layout the sort no longer supports still saves: the rows return to their item order, a read leaves the inactive `sort` out, and the saved sort stays until a supported layout brings it back or another `sort` replaces it: `NONE`, `AXIS_ASC` or `AXIS_DESC` without `column` (by item name), or `MANUAL` with `manualOrdering` each replace a column sort, and a `sort` with a different `column` replaces the column. `row_updates` and `column_updates` take the same `sort`. |
| `role` | `DIMENSION` lists a Dimension's items; `VARIABLE` holds one value of the Dimension for each item on the other axis. |
| `children` | The nodes nested beneath this node, in saved-node form: the same nesting a Variable's `breakdown` declares, and the way a Dimension node nests its levels. |

A `space` node, a `branches` node, and a node kept as saved by `target` alone take none of `children`, `role`, `grain`, `sort`, `summary`, or `members`.

A breakdown in the written notation and in the typed fields:

```text theme={null}
[Department, {Level[Department = "Engineering"], Owner}]
```

```json theme={null}
{
  "variable": "Headcount",
  "breakdown": [
    "Department",
    {
      "branches": [
        [{ "dimension": "Level", "when": { "dimension": "Department", "equals": "Engineering" } }],
        [{ "dimension": "Owner" }]
      ]
    }
  ]
}
```

How the items of two nested levels pair depends on what relates the levels:

* **A mapping relates them.** Each key item pairs with the item the mapping gives it, whether the key item was added by hand or comes from a source table. The rows are the items the mapping resolves, the catch-all included. A hand-added key item the mapping does not resolve pairs with every mapped item the rows have.
* **One source table's rows carry both.** The items pair as they do in those rows.
* **Neither relates them.** Every item of one level pairs with every item of the other.

## Canvas dataset layouts

A Canvas dataset declares the same visible shape in a flatter form, under its `layout.rows` and `layout.columns`. `inspect_canvas_blocks` reads each saved dataset back in this same form, as [Read saved Canvas blocks](https://docs.cfo.ai/agents/canvas-blocks.md#read-saved-canvas-blocks) describes, so an entry that carries `layout` copied from a read writes back unchanged; an entry that carries `layout_problem` instead has a saved layout this notation cannot express, and it must be rewritten before it is sent:

| Entry field | Meaning |
| - | - |
| `variable` | An existing Variable to read. |
| `breakdown` | The shared levels beneath it, outermost first. A level is a Dimension name, or an object with `dimension` or `time`; `include` and `when` go only on a `dimension` level. `breakdown`, the `branches` fork counted as one, and `after_branches` together hold at most 10 entries. |
| `branches` | Sibling paths as one list of 2 to 50 levels. Each level names its path with `branch`, a number from 1 to 50; levels with the same number form one path in list order. A fork takes at least two paths, each of up to 10 levels. One entry's levels, counting every level inside every path, number at most 50; past that it is refused with **accepts at most 50 combined dimension branches**. |
| `after_branches` | Levels that follow every branch. Each complete path is `breakdown`, then one branch, then `after_branches`. It needs `variable` and `branches` on the same entry; without both it is refused with **after\_branches requires a variable and sibling branches**. |
| `include` | The items to keep on that level, up to 50, written directly on the level. A table's `filter.include` takes up to 10,000. |
| `dimension`, `time` | A standalone grouping axis entry, such as the shared dates on `columns`. |

An entry with `branches` and no `variable` forms a shared grouping axis. [Canvas blocks for agents](https://docs.cfo.ai/agents/canvas-blocks.md#datasets) covers the rest of a dataset.

## Variables and Dimensions as rows

Each row in a table's view is either:

* a **Variable**, which measures something, such as Revenue, Headcount, or Gross Margin; or
* a **Dimension used as a mapping**, where each cell shows that Dimension's item for its row and column instead of a number. This suits a database-style list of entities and their attributes.

A Variable row can carry its own breakdown, splitting only that row differently from the rest of the table. A mapping row takes no breakdown. On a table, a `breakdown` on a Dimension node is refused before anything saves with **breakdown belongs to a variable; nest a dimension's levels with children**. On a Canvas dataset the refusal explains the record-key and mapped-field roles instead: consecutive Dimensions on the record axis are the key rows, and a Dimension on the value axis is a field showing the item each record is mapped to.

## Orientation

By default, a view with a measured Variable keeps values on rows, and its Dimensions, including time, on columns. A flipped view puts the Variables on columns instead. A mapping-only view has no Variable to mark a side. The side that carries a `filter`, a `when`, or `branches` is the key side, because only the record breakdown holds those; with none on either side, the longer side shows the mapped fields and the other side the keys. Such an entry on both sides is refused, because the side chosen for the fields cannot hold one. To read keys down the rows, put a `filter`, `when`, or `branches` on the key rows, or keep the `columns` list at least as long as the `rows` list. A node kept from the saved table keeps the saved orientation.

There is no separate transpose action. To flip a table, reshape it by moving the Variables between rows and columns. Moving an axis changes the presentation, not the grain of any cell.

A layout that puts values on both axes, such as a Department mapped field, which is a value, placed as a column beside monthly values while the rows already hold Variables (a Department breakdown beside the months is the usual valid layout), is refused on `create`, `reshape`, and `structure.insert` alike with **rows and columns both hold values or both hold breakdowns**, followed by each root entry's name, kind (variable, mapped field, dimension, time, formula column, space, or branch), and path, and the accepted layout: Variables and mapped fields on one axis, with their business or time breakdown and optional formula column on the other, where a Variable can also carry its own time breakdown.

## Member tables

A table whose rows are two or more plain Dimension rows and whose `columns` is an explicit empty list is a member table: each row lists one Dimension's items, an empty Dimension included, and no calculated value is on either axis. `create` accepts this shape.

A read of such a saved table, the Model page's shared **Dimensions** table included, returns one row per Dimension with `columns: []`. Each row is named by the qualified reference `create` resolves, such as `Entity#1a2b`, not by the Dimension's name, so two Dimensions whose names differ only in case read back as two rows. A row narrowed by a formula condition is not a member table row: it reads through the general layout, which keeps its `members` condition.

Two rows that resolve to the same Dimension are refused with `two rows name the same dimension; each row of a member table lists a different dimension's items`. When you cannot read one of the Dimensions, the read says `This saved table includes a dimension you cannot read.` and returns no layout.

## When a table comes back empty

An empty result on a table with dates often means the table's window, the date range and grain it is set to show, does not cover the dates that hold values. Writing dated values does not move the window: a `values` write that names a period outside it is refused, and the same request can widen `window` and write the new periods, as [Write values into dated columns](https://docs.cfo.ai/agents/write-formulas.md#write-values-into-dated-columns) describes. A wrong window is fixed on the table itself, with `window`. Two other causes are common:

* An item whose cells are all empty is hidden when the table hides empty items. `show_empty_members` sets this: `false` asks to hide items whose values are all zero or empty, subject to the workspace policy; omitted, `create` uses the workspace default and `update` keeps the saved setting.
* An item outside a formula's condition reads empty.

Check the table's window before you rework its breakdown.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.