Skip to main content

Computed Attributes

Define an attribute as a formula over other attributes on the same record, recalculated the moment any of them is saved.

Some attributes are not really separate data — they are other attributes, combined. A key built out of two codes, a label normalized to upper case, a cost rounded to two decimals. Computed Attributes let an admin define an attribute as a formula over other attributes on the same record, so Toolio keeps it correct instead of asking a planner to type it in.

The value is recalculated the moment any attribute the formula reads is saved, and the new value comes back in that same save. It is stored like any other attribute, so it works everywhere attributes are supported: grids, filters, grouping, exports and integrations.

❗ Computed Attributes are not Calculated Attributes. Calculated Attributes aggregate over Sales, Inventory, Receipts or Purchase Orders on a daily schedule. Computed Attributes read only other fields on the same record, and recalculate immediately on save.

Use Cases

  • Build an identifier or matching key by joining several codes into one value.

  • Normalize a value that is entered inconsistently — trim it, force it to upper case, pad it to a fixed width.

  • Derive a short label or flag from a value a planner already maintains.

  • Round or rescale a number so downstream exports and integrations receive a consistent format.

  • Fill a field automatically on new records, while still letting planners override it.

When Values Are Recalculated

Computed Attributes run inside the save itself, not on a later pass. Two things trigger a recalculation:

  1. A record is created. Every enabled computed attribute on that model is evaluated.

  2. A record is updated and the save touches an attribute the formula reads. Only the affected attributes are recalculated.

This applies to every write path, not just the grid — manual edits, bulk edits, imports and records created by other Toolio workflows all go through the same recalculation. A save that touches nothing a formula reads does no extra work.

Computed Attributes do not backfill. Creating a definition does not change records that already exist; each record picks up its value the next time it is saved.

Creating a Computed Attribute

Navigate to Settings > Configuration > Intelligence > Computed Attributes and click Add. You need the Settings edit permission to create, change or delete a definition.

[Screenshot: Computed Attributes list in Settings with the Add button]

Model

Choose the model the attribute belongs to. Computed Attributes are supported on Choice and Choice Offering. A formula can only read attributes on the same model as its target — there is no reading across models.

Attribute

Choose the attribute the formula writes into. Only one computed definition is allowed per attribute, so an attribute that already has one will not be offered again.

Formula

Write the expression that produces the value. See Writing Formulas below for the full syntax.

Mode

Mode decides whether the formula is allowed to overwrite a value that is already there.

Mode

When the value is written

Always

On create, and on every save that touches an attribute the formula reads. Also recalculates when someone edits the computed attribute itself, so a manual entry is replaced immediately.

If Empty

Only when the attribute is empty. Once it holds a value — computed or typed in — it is left alone. If the value is later cleared, the next save that touches an input fills it again.

Use Always when the formula is the only acceptable source of the value. Use If Empty when you want a default that planners are allowed to override.

Preview

The preview runs your formula against the first ten records of the model and shows the input values it read and the value it produced, before you save the definition. If the formula is invalid, or fails on a particular record, the preview shows the error instead.

[Screenshot: Computed attribute editor with formula and preview rows]

Writing Formulas

A formula is a single expression. Reference an attribute by putting its slug in braces — the slug is shown next to each attribute on the Attributes page.

{choice__col_style_code} + "-" + {choice__col_color_code}

Operators

  • Arithmetic: +, -, *, /, %, **

  • Comparison: ===, !==, <, >, <=, >= — note the three-character forms; == and != are rejected

  • Logic: &&, ||, ??

  • Conditional: condition ? valueIfTrue : valueIfFalse

Functions

  • Convert: String(...), Number(...)

  • Math: Math.abs, Math.ceil, Math.floor, Math.max, Math.min, Math.round, Math.trunc

  • Text: charAt, endsWith, includes, indexOf, padEnd, padStart, replace, replaceAll, slice, startsWith, substring, toLowerCase, toUpperCase, trim, trimEnd, trimStart

  • Number formatting: toFixed

  • Text length: .length

Anything outside this list is rejected when you save the definition, with a message naming the part of the formula that is not allowed.

Examples

Math.round({choice_offering__col_landed_cost} * 100) / 100
{choice__col_season_code}.toUpperCase().trim()
String({choice__col_class_number}).padStart(4, "0")
{choice__col_display_label} ?? {choice__col_style_code}

Empty Values

Every operation on an empty input produces an empty result. If one of the attributes your formula reads is blank, the whole formula returns blank rather than a half-built value — a key missing one of its parts is worse than no key at all.

Only ??, || and the conditional operator can supply a fallback for an empty input. Use them when a blank input should still produce a value:

{choice__col_style_code} + "-" + ({choice__col_color_code} ?? "NA")

Which Attributes Can Be Used

A formula can read any stored attribute on its model, including the core fields Toolio maintains and other computed attributes. Single-select attributes are read as their option label, not their internal id.

These cannot be read by a formula:

  • Record bookkeeping fields — the internal id, created and updated timestamps, and the import job reference

  • Attachment attributes

  • Attributes that are worked out at read time rather than stored, including planning metrics

  • Single-selects that point at another record type, with the exception of Assortment Group

The attribute a formula writes into has further restrictions. It cannot be a single-select or an attachment, it cannot be a field Toolio maintains itself (identifiers, status, hierarchy path, location fields), and it cannot be one of the fields whose own save recalculates other values — count multiplier, launch date, end date, phase-out date, unit cost and unit ticket.

Chaining and Cycles

One computed attribute can read another. Toolio works out the dependency order and evaluates them in sequence within the same save, so a formula always sees the up-to-date value of any computed attribute it reads.

Definitions that reference each other in a loop are skipped rather than evaluated, along with anything that depends on them. If a computed attribute stops producing values, check whether a recent definition closed a cycle.

Managing Computed Attributes

The list in Settings shows every definition with its model, attribute, formula and status.

Disabling a Definition

Toggle a definition off to stop it recalculating. Values already written stay exactly as they are — disabling does not clear them, it only stops future saves from updating them.

Editing a Definition

Edit the formula or the mode at any time. Changes apply from the next save onward; records that were already computed keep their old value until something triggers a recalculation.

Deleting a Definition

Deleting removes the definition only. The attribute and the values it wrote remain, and the attribute becomes a plain editable field again.

FAQs

Why did nothing happen when I created the definition?

Computed Attributes only run on save. Existing records keep their current value until the next time they are saved, and creating the definition is not itself a save. To populate records now, trigger a save on them — for example by re-importing or editing one of the attributes the formula reads.

My planner typed a value and it disappeared. Why?

The definition is in Always mode, which recalculates whenever the computed attribute is edited and replaces the entry. Switch it to If Empty if planners should be able to override the computed value.

One attribute in my formula is blank and the whole value came out blank. Is that a bug?

No — that is deliberate. Any empty input makes the whole formula empty, so you never get a partial value that looks valid. Use ?? or a conditional to supply a fallback for the input that can be blank.

Some records got the new value and some did not. What happened?

A computed value that does not fit its column — too long for the field, outside the allowed range, or a duplicate where the column requires uniqueness — is skipped for that record only. The rest of the save completes normally. Check the formula against the column's type and length.

Can a formula read an attribute from a related record?

No. A formula reads only attributes on the same record. The one exception is a single-select pointing at an Assortment Group, which resolves to the group's name.

Does this slow down imports and grid saves?

Toolio checks whether the save touches anything a formula reads before doing any work, so saves that are unrelated to your definitions are unaffected. Saves that do trigger a recalculation carry the work inline, which is what makes the value available immediately.

Can I use Computed Attributes on other models?

Not today. Choice and Choice Offering are the supported models.

Did this answer your question?