> For the complete documentation index, see [llms.txt](https://docs.middle.app/middle-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.middle.app/middle-docs/product/accounts/workflow-parameters/constants-and-calculated-values.md).

# Constants and Calculated Values

These parameters provide a fixed value or calculate one from other parameters. The JSON examples show the complete parameter objects used in a copied workflow. Child parameters appear in the `params` array, in the same order as they appear in the editor.

## Number

**JSON type:** `math_expression`. **Expression:** a number or mathematical expression. **Result:** a number, or a date, datetime, or timedelta when doing date arithmetic.

A static number or formula. You can use `{}` to input variable parameters into a formula. Click **+ Parameter** to add new parameters. The order of the parameters matches up with the order of `{}` entered in the formula. For example, to convert a value from cents to dollars, your number formula would look like this: `{} * 0.01`.

Use `{0}` for the first child, `{1}` for the second, and so on when you want to use a child more than once or change the order. Repeated references to the same child use the same evaluated value. Do not put workflow variable names directly in the formula; add a [Variable Selector](https://docs.middle.app/middle-docs/product/accounts/workflow-parameters/variables.md#variable-selector) as a child and reference its placeholder.

Supported operators are `+`, `-`, `*`, `/`, `**` (power), and `%` (remainder). Parentheses control the order of operations. A leading minus sign is allowed. Functions are `floor(value)`, `ceil(value)`, `round(value)` or `round(value, decimal_places)`, and `abs(value)`. Rounding uses Python's rules: halfway values round toward the nearest even choice, and decimal fractions can be affected by floating-point precision. Other function calls, comparisons, `//`, and a leading plus sign are not supported.

Children must supply numbers, dates, datetimes, or timedeltas that make sense for the operation. Text is not automatically converted to a number; use [Parse Number](#parse-number) first. Missing placeholders, null operands, invalid formulas, and operations such as dividing by zero cause an error. Date and datetime arithmetic is described under [Timedelta](https://docs.middle.app/middle-docs/product/accounts/workflow-parameters/dates-and-datetimes.md#timedelta).

This example converts 1,250 cents to `12.5`:

```json
{
  "type": "math_expression",
  "expression": "{} * 0.01",
  "params": [
    {
      "type": "math_expression",
      "expression": "1250"
    }
  ]
}
```

A fixed number needs no children:

```json
{
  "type": "math_expression",
  "expression": "25"
}
```

## Parse Number

**JSON type:** `parse_number`. **Expression:** unused. **Children:** one value to convert. **Result:** a number.

Turn text into a number. Text containing a decimal point is parsed as a decimal number; text without a decimal point is parsed as an integer. Leading and trailing whitespace and a leading `+` or `-` are accepted. An existing number stays unchanged, and null becomes `0`.

Blank text, commas, currency symbols, and invalid numeric text cause an error. For example, `"12.50"` works but `"$12.50"`, `"1,250"`, and `""` do not. Scientific notation without a decimal point, such as `"1e3"`, is not accepted; `"1.0e3"` is. This parameter does not evaluate a formula written as text.

This example returns `12.5`:

```json
{
  "type": "parse_number",
  "params": [
    {
      "type": "template",
      "expression": "12.50"
    }
  ]
}
```

## Text

**JSON type:** `template`. **Expression:** text with optional placeholders. **Result:** a string.

A static string or a string with variable inputs. You can use `{}` to input variable parameters. Click **+ Parameter** to add new parameters. The order of the parameters matches up with the order of `{}` entered in the string. For example, to insert someone's first name in a string, your text would look like this: `Hello {}, Thank you for being a customer!`

As with Number, `{0}` selects the first child, `{1}` selects the second, and an indexed placeholder can be repeated. `{}` advances through the children independently of any indexed placeholders, so using one style consistently is easier to read. Use `{{` and `}}` to include literal braces. `{name}` is ordinary text, not a named variable reference. A placeholder for a missing child causes an error; unused children are flagged in the editor.

Text children are inserted as they are. Other values are converted to text: numbers become numeric text, booleans become `true` or `false`, null becomes `null`, and arrays and objects become JSON text. Null is not replaced with a blank string. Spaces and newlines in the expression are preserved. See [Text Manipulation](https://docs.middle.app/middle-docs/product/accounts/workflow-parameters/text-manipulation.md) to change case, remove whitespace, or split text into lines.

This example returns `Hello Sally, you have 25 points.`:

```json
{
  "type": "template",
  "expression": "Hello {0}, you have {1} points.",
  "params": [
    {
      "type": "template",
      "expression": "Sally"
    },
    {
      "type": "math_expression",
      "expression": "25"
    }
  ]
}
```

An empty Text parameter returns an empty string:

```json
{
  "type": "template",
  "expression": ""
}
```

## Boolean

**JSON type:** `boolean`. **Expression:** `BOOLEAN_IS_TRUE` or `BOOLEAN_IS_FALSE`. **Children:** none. **Result:** true or false.

A fixed value of true or false. The JSON `expression` is one of the strings above, not the JSON values `true` and `false`, and not the strings `"true"` and `"false"`.

This example returns true:

```json
{
  "type": "boolean",
  "expression": "BOOLEAN_IS_TRUE"
}
```

This example returns false:

```json
{
  "type": "boolean",
  "expression": "BOOLEAN_IS_FALSE"
}
```

## Null

**JSON type:** `make_null`. **Expression:** unused. **Children:** none. **Result:** null.

A null value means no value. It is different from an empty string, zero, false, or an empty array. To test whether a value is null, use [If](https://docs.middle.app/middle-docs/product/accounts/workflow-parameters/flow-control.md#if) with `VALUE_IS_NULL` or `VALUE_IS_NOT_NULL`.

```json
{
  "type": "make_null"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.middle.app/middle-docs/product/accounts/workflow-parameters/constants-and-calculated-values.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
