Skip to main content
A variable is a named value within a domain — a home price, an interest rate, a monthly payment. Variables are what activities relate, and what you provide and receive when you run a calculation.

What a variable has

A variable is defined in a domain and takes on a value when a calculation runs. As defined, a variable has:
  • A key — an identifier, unique within the domain. You reference a variable by its key when you provide or solve for it (see Input formats), and the API returns it on each variable.
  • A title and description — human- and agent-readable labels.
  • A type and display format — how the value is interpreted and shown (see below).
  • A default value — an optional value and unit used when none is provided.
When a calculation runs, each variable also has:
  • A value — the number or table it currently holds, with its unit where applicable; the unit travels with the value (see Units and precision).
  • Provenance — where that value came from: user-stated, calculated, carried forward, or a default. See Provenance.

Types and display formats

A variable holds one of TrueMath’s value types — a scalar number, a unit number, or a table — and specifies how it should be displayed:
  • number — a plain number, shown with thousands separators and a chosen decimal format. A monetary amount is a number whose unit is a currency (for example USD).
  • percent — a rate shown as a percentage.
  • no_separator — a number shown without thousands separators (for example, a year).
  • table — a collection of values with named rows and columns.
  • bar_chart / pie_chart — a table presented as a chart.
For how values combine across types, see Combining types. For authoring variables, see Defining variables.
To list the variables in a published domain, use GET /v1/domains/:id/variables.