Skip to content

Formulas

Formulas work things out from the answers: a worked-out attribute, a component’s quantity or cost, an option’s price. Conditions are formulas that give yes or no, such as a component’s When. Templates are text with attributes in braces.

Every formula field checks what you type against the family. A problem is underlined, with a message beneath it saying what’s wrong and where, such as Unknown attribute [Drive cuont]. Did you mean [Drive count]? (at character 1). When it checks, the field shows what the formula gives and which attributes it uses. A formula with a problem never stops you pressing Save: Save takes you to it instead.

  • Attributes go in square brackets: [Drive count]. Type [ to choose from the family’s attributes.
  • Numbers are written plainly: 1200, not 1,200. They’re exact decimals, so money and quantities add up.
  • Text goes in double quotes: "Rack 2U". A choice is compared with one of its values by name or code: [Chassis] = "Rack 2U". A value that doesn’t exist is an error when you save.
  • Yes and no are yes and no.
  • Upper and lower case don’t matter in keywords, function names or attribute names.
OperatorMeaningExample
+ - * /Add, subtract, multiply, divide[Drive count] * 12 + 150
= <>Equal, not equal[Chassis] <> "Tower"
< <= > >=Less than, at most, more than, at least[Width] > 900
in (…), not in (…)One of a list[Chassis] in ("Rack 1U", "Rack 2U")
between … and …Within a range, ends included[Width] between 600 and 900
includes, excludesFor attributes that hold several values[Extras] includes "Spare fan"
and, or, notCombine conditions[Redundant power] and not [Chassis] = "Tower"
( )Group([Width] + 50) * 2
FunctionGivesExample
if(condition, then, otherwise)One of two valuesif([Redundant power], 2, 1)
min(a, b, …), max(a, b, …)The smallest or largestmax([Drive count], 2)
round(x, places)Rounded to the nearest, halves away from zero; 0 places if left outround([Power needed] / 1000, 1)
roundup(x, step)Up to the next multiple of the step; 1 if left outroundup([Power needed], 50)
rounddown(x, step)Down to the multiple of the step; 1 if left outrounddown([Width], 10)
abs(x)Without its signabs([Offset])
answered([Attribute])Yes once the attribute has an answerif(answered([Drive count]), [Drive count], 0)
lookup("Lookup", "Column")A value from a lookup’s matching rowlookup("Power supplies", "Watts")

Until an attribute is answered, anything that uses it is unknown, not zero. A component whose quantity is unknown waits until it can be worked out, and a condition that’s unknown doesn’t apply yet. To give a value before then, test it: if(answered([Drive count]), [Drive count] * 12, 0).

A made part’s materials use formulas per one made part. Some examples for a panel whose frame is cut from bar stock:

FieldFormulaGives
A material’s Quantity per made part[Width] * [Height] / 1000000 * 0.2The litres of coating for the panel’s area
A cut piece’s Piecesif([Leaves] = 2, 4, 2)Four rails on a double, two on a single
A cut piece’s Length[Height] - 40Each side, in the cutting unit
A cut piece’s Width[Width] - 100A piece cut from a sheet, such as an infill

Pieces must be whole numbers, and lengths and widths above zero. A quantity of 0 or less, or no pieces, leaves the row out, so if([Glazed], 1, 0) is another way to make a row optional.

A condition gives yes or no: [Chassis] = "Tower" and [Drive count] > 4. A yes/no attribute on its own is a condition: [Redundant power]. Use brackets to group and and or: [Chassis] = "Tower" or ([Drive count] > 4 and not [Redundant power]).

Descriptions, code templates and messages are text with attributes in braces:

PlaceholderGivesExample
{Attribute}The answer, with a number’s unit and decimals{Memory size} gives 128 GB
{Attribute:code}The value’s codeRAIL-{Chassis:code} gives RAIL-2U
{Attribute:0.0}A number in that format{Power needed:0} gives 450

Type { in a template to choose an attribute. To show a brace itself, write it twice: {{ or }}.

A formula can be up to 2,000 characters long and nested 32 brackets deep. Something that can’t be worked out, such as a division by zero, shows as a problem on that formula rather than stopping the configuration.