Logic

Calculated field

Calculated field adds new fields to every item, worked out from the fields it already has: a score out of 100, a grade A, B or C, a label made of the city and the name, the distance to your warehouse, the days since a date. Write one per line as name = formula; later lines and later blocks (Filter, Sort, an email, your CRM) can use the new fields.

In the editor: Adds fields worked out from the others: a number, a text or a yes/no. One per line, as name = formula. Later lines and later blocks (Filter, Sort, Email) can use the new fields.

Settings

Fields to add

Text, several lines

Up to 10 lines. Each one is a name (letters, numbers and _, starting with a letter), an equals sign and a formula. A line can use the fields made by the lines above it.

One per line: name = formula. Use {{field}} for a field. Numbers: + - * / % ^, round(x, 1), floor, ceil, abs, sqrt, min, max. Text: join with &, and lower, upper, trim, len, left, right, replace(text, find, with), contains(text, part). Choices: if(test, then, else), and, or, not, = != < <= > >=, default(x, fallback). Also distance(lat1, lng1, lat2, lng2) in km, today(), days_since(date).

Needed before the flow can run.

What comes out

Each item that leaves the block carries these fields, to use in the blocks after it as {{field}}.

Each item, with the new fields

Every item goes on with all its fields, plus one for each line, named as you wrote it.

  • score_100: From score_100 = round({{rating}} / 5 * 100).
  • grade: From grade = if({{rating}} >= 4.5, "A", if({{rating}} >= 4, "B", "C")).
  • label: From label = upper({{city}}) & ": " & {{name}}.
  • km: From km = round(distance({{lat}}, {{lng}}, 52.52, 13.41), 1): the straight-line distance in km.
  • is_cafe: A test gives Yes or No, ready for Filter: is_cafe = contains(lower({{category}}), "caf").
  • age_days: From age_days = days_since({{first_seen}}), with Only new before it.

How to use it

Sales

Grade A places only

A sales team wants a simple A, B or C on every new cafe and only the A grades in its morning email.

Another field: grade is A, in Filter, reads the field this block adds.

Logistics

Distance to the warehouse

A distributor receives new sites by webhook and wants them in a sheet, nearest the warehouse first.

Before: Someone measured each site on a map before the weekly call.

With the flow: Each site arrives with km and the sheet is already in order.

FMCG distribution

A route label for each shop

Text joined with & makes one column the route planners sort and read at a glance.

Banking and payments

A merchant score out of 100

A payments company turns the AI’s fit score and the rating into one number its sales team trusts.

Recruitment and B2B sales

How long a job has been open

days_since works on any date field, here first_seen from Only new.

Government and cities

Rain in words

A city team wants each forecast day labelled Heavy, Light or Dry in the morning email.

Telecom

Distance between each incident and a site

A telecom operator wants to know how far each road closure is from its main switching site.

Make a yes or no field first, such as near = if(km < 3, "yes", "no"), then Filter keeps near is yes.

Good to know

  • Formulas are worked out by xMap, never run as code, so they are safe in any flow, shared or not.
  • Functions: round, floor, ceil, abs, sqrt, min, max; lower, upper, trim, len, left, right, replace, contains; if, and, or, not, default; distance (km, in a straight line), today, days_since. Text is joined with &.
  • If a formula cannot be worked out for an item (a missing rating, text where a number is needed), that field is left empty and the run says how many. The rest of the item goes on.
  • A formula that cannot be read is shown as a problem in the block before you run.
  • Up to 10 lines per block, and texts of at most 10,000 characters. For more than that, Custom code runs your own JavaScript.
  • A decimal comma is read as a number: 4,5 is 4.5.
  • Calculated field is free and runs the same in the editor’s preview and in real runs.

Works well with

  • Filter: Keeps only the items that match a rule.
  • Sort and limit: Puts the items in order, and can keep only the first ones: the 10 best rated, the 20 nearest, the highest fit scores.
  • Branch: Splits items in two.
  • Custom code: Your own JavaScript, for what the other blocks cannot do: change, add or drop fields, filter and reshape the items.
  • xMap LLM: Tell the AI what to do in plain words.
  • Find nearest: For each place, finds the nearest of your own points from a CSV you upload, for example the nearest ambulance to each accident or the nearest branch to each new lead, and adds its name and the distance.
  • Email: Sends one email per run with all the items, or one email per item.
  • HubSpot: Powerful CRM that offers tools for sales, customer service, and marketing automation.

Templates that use it

And 46 more in the template gallery.

Stories with it

Industries that use it

Retail & franchise · Restaurants & cafes · Real estate · FMCG & distribution · Marketing & agencies · Logistics & delivery · Government & cities · Investors & consultants · Healthcare & pharma · Hotels & tourism · Banking & lending · Energy & EV · Telecom · Automotive & mobility · Education & training · Agriculture & food supply · Fitness, beauty & wellness · Law & professional services · Media & publishing · Events & venues · Non-profits & humanitarian · Security & emergency services · Environment & climate · E-commerce & D2C · Manufacturing & industrial · Sports clubs & leagues · Pet care & veterinary · Home services & trades · Food delivery & quick commerce · Airports & aviation · Mining, oil & gas · Public transport

Try it

Build a flow with Calculated field on the home page, no account needed, or book a call. Try it live