Table of Contents

Set a field calculations: add, subtract, multiply and divide numbers

Desirée M Updated by Desirée M

The Set a field block can do one calculation each time it runs: add, subtract, multiply or divide two numbers, find the remainder of a division, or move a date forward or back. Use it to work out an order total, add a delivery fee, apply a discount or set a pickup date, without writing a formula.

To learn the block itself, see Set a Field block. For several steps in one block, rounding or text, use the Formulas block instead: How to use the Formulas block: a beginner's guide explains it.

How do you set up a calculation in Set a field?

A calculation needs a Number Field to save the result in, or a Date Field to move a date. In the Set a field block:

1️⃣ In Field to edit, pick a Field or type a new name and click Create new field, then pick Number.

2️⃣ Turn on Perform a calculation?.

3️⃣ In Start value, type a number or a Field, such as @pizzas, or click Use field to pick one.

4️⃣ Pick the operation: + adds, - subtracts, *** multiplies, / divides and %** gives the remainder.

5️⃣ In the second box, type a number or a Field.

6️⃣ Click Apply.

The block saves the result in the Field to edit, so any later block can show it, such as a message with @total. Each Set a field block does one operation: for a total with several steps, connect one block after another. A whole result shows without decimals, such as 50, and a decimal one as it comes, such as 52.5.

How to calculate an order total, a discount and a pickup date

The examples below come from one pizzeria agent, Forno Rosa, which takes group orders. An Ask for a number block asks "How many pizzas would you like for your group? They're 12.5 € each." and saves the answer in @pizzas.

Multiply and add: work out the total

Two Set a field blocks in a row work out the total. The first saves @pizzas * 12.5 in @subtotal, and the second saves @subtotal + 2.5 in @total for the delivery fee. A message then shows both:

● 4 pizzas: "4 pizzas come to 50 €, plus 2.5 € delivery: 52.5 € in total."

● 3 pizzas: "3 pizzas come to 37.5 €, plus 2.5 € delivery: 40 € in total."

Percentages: apply a discount

Set a field has no percentage operation, so a percentage is a multiplication: * 0.9 takes 10 % off, and * 1.1 adds 10 %. Forno Rosa asks "Are you a student? Students get 10 % off." with a Buttons block:

● Yes: a Set a field block saves @total * 0.9 in @total, and the agent says "With the student discount, you pay 47.25 €."

● No: the agent goes straight to the pickup date, and the total stays the same.

Set a field block multiplying the total by 0.9 for a 10 percent student discount, after the Yes button
Saving the result in the same Field replaces its value, so every later block uses the discounted total.
The % operation is not a percentage: 100 % 30 gives 10, the remainder of 100 divided by 30.
Dates: set a pickup date

With a Date Field in Field to edit, the block moves a date forward or back. The panel then shows Value, Select the operation (+ Add or - Substract), and Enter the amount or select a field with a unit: Day(s), Month(s) or Year(s). Forno Rosa asks "On which day are you placing the order?" with an Ask for a date block, saves the answer in @order_day, and saves @order_day + 1 Day(s) in @pickup:

● 2026/12/04: "Group orders are ready the next day, so you can pick yours up on 2026-12-05. See you then! 🍕"

Web chat showing the order total, the student discount and a pickup date one day after the order date

The result is written as YYYY-MM-DD. Adding a month to 31 January gives 28 February, the last day of the shorter month.

What happens when a calculation can't be done?

A calculation that can't be done, such as a division by zero, sends the conversation through the block's Failed output and leaves the Field empty. Connect Failed to a message or another step, so the conversation doesn't stop there.

When should you use Formulas instead of Set a field?

Set a field covers one operation at a time. The Formulas block does more in one step:

● Math formulas round a result to 2 decimals, split a bill between several people, or combine several operations in one formula.

● Date formulas add hours or minutes, read dates typed as text, and get today's date.

Was this article helpful?

How to use the Formulas block: a beginner's guide