Skip to main content
A table is a collection of values arranged in rows and columns — a single column (one-dimensional) or a two-dimensional grid. In software terms, a table is TrueMath’s array type: a one-dimensional table is a list (or vector), and a two-dimensional table is a matrix. Tables hold series and matrices: a list of cash flows, an amortization schedule, a lookup grid. They are 1-indexed (the first row and column are index 1) — unlike arrays in most languages — and each cell holds a value with its own optional unit. Cells may carry different units, or none. The same table can appear in three places — written in an equation, returned by the API, or sent as input. The notation differs; the table is the same.

In equations

In an activity equation, a table is a bracketed literal with semicolons separating entries (commas are never used as they can be confused with decimal or thousands separators). A bare list is a single column — [3; 4; 5] is three rows of one column — and nesting a bracketed list adds columns:
Cells may carry units, may mix units, and may be left empty:
Mixed units are allowed to coexist in a table, but arithmetic across cells with incompatible dimensions still errors — see Combining types.

Element-wise operations

  • With a scalar — applies to every cell: [1; 2; 3] * 2[2; 4; 6].
  • With another table — element-wise; shapes must match: [1; 2] + [3; 4][4; 6].
Read and reshape tables with table functions (item, row, column, subset, lookup, sort, append, length, width) or aggregate them with statistics functions (sum, avg, stddev).

As a stored value

When a table is returned by the API or held in a scenario, it is represented as an array of strings — one per cell, each combining the value and its unit. Because the unit lives inside each cell, a table variable’s own unit is empty.

As input

To provide a table as input, write it in structured text — semicolons separate cells, and brackets or new lines separate rows, with optional per-cell or outer units. See structured text.

Display

In a domain, a table-valued variable can be displayed as a table or as a bar or pie chart.