Skip to content
Docs
  1. Docs
  2. Variables
  3. Formulas and conditions

Variables

Formulas and conditions

Calculate from your fields with {{=…}}, and insert text only when something is true with {{if:…}}.

On this page

Formulas: {{=…}} Pro#

Start a variable with = to calculate something. Formulas can use numbers, text in double quotes and the fields of the same snippet. The result updates live in the fill-in window as you type.

A price quote Pro

Qty: {{name:Qty|10}}
Unit price: ${{name:Unit price|4.5}}
Total: ${{=fixed(Qty*[Unit price])}}{{if:Qty>=50| (bulk discount applied)|}}

You fill in

Qty
60
Unit price
4.5

Result

Qty: 60
Unit price: $4.5
Total: $270.00 (bulk discount applied)
The Price quote fill-in window: Quantity 60, Unit price 4.5, Total $270.00 (bulk discount applied).
The total and the bulk-discount note update as you type.

Using fields#

  • Refer to a field by its label: Qty. Wrap labels with spaces or symbols in square brackets: [Unit price].
  • A formula can only use fields defined in the same snippet, with name, pick, toggle and the other field variables.
  • An answer that looks like a number is treated as a number; anything else is text.
  • true and false are also values.

Operators#

OperatorMeaningExampleResult
+ - * /Add, subtract, multiply, divide{{=1+2*3}}7
%Remainder{{=7%3}}1
( )Group{{=(1+2)*3}}9
-xNegative{{=-2+5}}3
&Join as text{{="a" & 1}}a1
= or ==Equal (text ignores case){{="Yes"="yes"}}yes
!=Not equal{{=2!=3}}yes
< > <= >=Compare numbers{{=5>=10}}no
and or notCombine conditions{{=not false and 1<2}}yes

Multiplication and division happen before addition and subtraction; comparisons come next, then not, and and or. Use parentheses when in doubt. + adds numbers but joins text when either side is text.

Arithmetic Pro

{{=1+2*3}} {{=(1+2)*3}} {{=10/4}} {{=7%3}} {{=0.1+0.2}}

Result

7 9 2.5 1 0.3

Functions#

FunctionWhat it doesExampleResult
round(x, places)Round; places defaults to 0{{=round(2.345, 2)}}2.35
floor(x)Round down{{=floor(1.8)}}1
ceil(x)Round up{{=ceil(1.2)}}2
abs(x)Remove the minus sign{{=abs(-4)}}4
min(a, b, …)Smallest of up to 20 values{{=min(3, 1, 2)}}1
max(a, b, …)Largest of up to 20 values{{=max(3, 1, 2)}}3
fixed(x, places)Always show this many decimals (default 2, up to 10){{=fixed(2/3)}}0.67
upper(text)Upper case{{=upper("ok")}}OK
lower(text)Lower case{{=lower("OK")}}ok
len(text)Number of characters{{=len("héllo")}}5
if(test, a, b)a when the test is true, otherwise b (or nothing){{=if(2>1, "big", "small")}}big

Functions with fields Pro

{{name:Qty}} × {{name:Unit price}}
Total: {{=round(Qty*[Unit price],2)}} ({{=if(Qty>10,"bulk","single")}})

You fill in

Qty
12
Unit price
0.1

Result

12 × 0.1
Total: 1.2 (bulk)

Text functions Pro

{{name:Code}} → {{=upper(Code & "-x")}} ({{=len(Code)}} characters)

You fill in

Code
ab12

Result

ab12 → AB12-X (4 characters)

Conditions: {{if:…}} Pro#

{{if:test|text when true|text when false}} inserts one of two pieces of text. The test uses the same operators as formulas. The “false” part is optional, and may itself contain |.

Combining tests Pro

{{name:Qty}} item(s){{if:Qty>10 and not Rush| at the bulk price| at the standard price}}{{toggle:Rush|, rushed}}

You fill in

Qty
12
Rush
left empty

Result

12 item(s) at the bulk price

Text comparisons ignore case Pro

{{pick:Answer|Yes|No}}: {{if:Answer="yes"|We’ll book it.|No problem.}}

You fill in

Answer
Yes

Result

Yes: We’ll book it.

A value counts as false when it is empty, 0, the text "0", or false. Everything else is true, so an unticked toggle is false and a ticked one is true.