Pricing Contacts Log in Book a demo Get started

Using the rules editor

Some decisions in Breww are best described as a flowchart: "if the order is large, deliver it tomorrow, otherwise deliver it in 3 days". The rules editor is where you build these. You place questions and answers on a canvas, then draw lines between them to show Breww which way to go.

This guide uses delivery rules as the example, but the editor works in the same way wherever you find it:

Rules Where to find them Outcome block What the options mean
Delivery rules Settings -> Deliveries -> Automatic delivery scheduling rules Delivery Delivery rules
Best before rules from packaging Settings -> Production -> Best before rules - from packaging Best before Best before/expiry dates
Best before rules from delivery Settings -> Production -> Best before rules - from delivery Best before Best before/expiry dates
Purchase order approval rules Settings -> Stock, sites & purchasing -> Purchase order approval rules Approval Purchase order approval
Batch reading schedule rules Settings -> Production -> Batch reading forms -> Batch reading schedule rules Reading schedule Batch reading schedule rules

You'll need the Settings permission to open any of these editors.

How rules work

Every set of rules is made from three kinds of block:

  • Start - where Breww begins. There is always exactly one, and it can't be deleted.
  • Condition - a yes or no question, such as "Is this a large order?". It has one connector on top for the line coming in, and two connectors underneath for the lines going out: a green check mark for "yes" and a red cross for "no".
  • Outcome - the answer at the end of a path. It's called Delivery, Best before, Approval or Reading schedule, depending on which rules you're editing. It only has a connector on top, because nothing comes after it.

A condition block called "By 10am?", with an input connector on top and a green check mark and red cross output underneath

Whenever Breww uses your rules, it starts at Start and follows the line to the next block. At each condition it answers the question, then follows the green check mark line for "yes" or the red cross line for "no". It carries on until it reaches an outcome, and uses that outcome.

A few things follow from this:

  • Only one outcome is ever used. Breww follows a single path, so it never combines two outcomes.
  • The order of your conditions matters. Ask your most specific questions first, and let the last outcome on a path act as your catch-all.
  • Where blocks sit on the canvas makes no difference. Only the lines between them matter, so arrange them however is easiest for you to read.
  • Changes save as you make them. There's no save button for the canvas itself.

A worked example

In this guide, we'll build delivery rules that do the following:

  • If the rules run by 10am, deliver the next day.
  • If it's after 10am, still deliver the next day for large orders (worth 500 or more).
  • Deliver everything else in 3 days.

To follow along, go to Settings -> Deliveries -> Automatic delivery scheduling rules. The Start block is already on the canvas, and the panel in the top-left corner lists the blocks you can add.

Adding a condition

  1. Drag Condition from the panel in the top-left corner and drop it onto the canvas.
  2. Enter a Name. This is shown on the block, so phrasing it as a question makes your rules easier to read, for example "By 10am?".
  3. Under Conditions, choose what to check from the first dropdown (here, Time of day), then choose how to compare it (less or equal) and enter the value (10:00).
  4. Press Save. The condition appears on the canvas where you dropped it.

The add delivery condition form, checking whether the time of day is less than or equal to 10:00

A single condition can check more than one thing:

  • Add rule adds another check. Choose AND if every check must be true, or OR if any one of them is enough.
  • Add group adds a set of checks in brackets, so you can build questions such as "(customer tag is Priority OR total value is over 500) AND day of week is Friday".
  • Delete removes a check.

Breww won't save a condition until every check in it is complete.

For our example, add a second condition called "Large order?" that checks Total value is greater or equal to 500.

The options you can check depend on which rules you're editing. The guides linked in the table above explain each one.

Adding an outcome

  1. Drag the outcome block (for delivery rules, Delivery) from the panel and drop it onto the canvas.
  2. Fill in the form to say what should happen. The optional Label is only there to help you recognise the block on the canvas, and has no effect on your rules.
  3. Press Save.

The add delivery action form, set to schedule an own vehicle delivery 1 day after the order date

For our example, add two Delivery outcomes: "Next day delivery", set to 1 day, and "Delivery in 3 days", set to 3 days.

Drawing lines between blocks

Blocks don't do anything until they're joined up. To draw a line:

  1. Press and hold on a connector underneath a block. This is the connector under Start, or the green check mark or red cross under a condition.
  2. Drag to the round connector on top of the block that should come next.
  3. Let go. The line stays in place and is saved straight away.

A line being dragged from the red cross of the "Large order?" condition towards the "Delivery in 3 days" outcome

Some things to know about lines:

  • Each output can only have one line. If you draw a new line from an output that already has one, the new line replaces the old one. This is the quickest way to reroute a path.
  • A block can have many lines coming into it. Several paths can finish at the same outcome, which keeps your rules tidy. In our example, both "yes" answers lead to "Next day delivery".
  • Never draw a line back to an earlier block. Breww would go round in circles and never reach an outcome. The editor lets you draw one, but shows it in red so you can fix it (see Loops below).

For our example, draw these lines:

  1. Start to "By 10am?".
  2. The green check mark of "By 10am?" to "Next day delivery".
  3. The red cross of "By 10am?" to "Large order?".
  4. The green check mark of "Large order?" to "Next day delivery".
  5. The red cross of "Large order?" to "Delivery in 3 days".

Complete delivery rules, where every output of every condition is connected and every path ends at a Delivery outcome

Changing your rules

  • Edit a block: press the pencil button on it.
  • Move a block: drag it by its title.
  • Delete a block: press the bin button on it and confirm. Any lines going into or out of it are removed as well. The Start block can't be deleted.
  • Remove a line: click the line to select it, then press Delete (or Cmd + Backspace on a Mac). If nothing happens, click an empty part of the canvas first and then select the line again.
  • Move around the canvas: drag an empty part of the canvas. Hold Ctrl and scroll to zoom in and out.

How the editor flags problems

The editor checks your rules every time you change them, and marks anything that would stop them working on the canvas itself.

Whenever an output has nothing connected to it, or a line leads back to an earlier block, a red alert appears above the canvas: These rules won't work as expected. Press Show me to move the canvas to the first problem, and press it again to move on to the next one. Once every problem is fixed, the alert disappears.

The red 'These rules won't work as expected' alert above the rules editor canvas, with a Show me button

The alert stays hidden while Start is the only block on the canvas, so it doesn't appear before you've begun building your rules.

There are three kinds of marker:

Marker What it means Stops your rules working?
A red dashed line hanging from a connector, labelled Connect "Yes" to a step, Connect "No" to a step or Connect Start to a step A dead end Yes
A red line with a moving dash, labelled Leads back to an earlier step A loop Yes
A faded block with a dashed border, labelled Not connected - never used A block that is never used No

Dead ends

A dead end is any output with nothing connected to it: the connector under Start, or a green check mark or red cross under a condition.

The editor marks each dead end with a red dashed line hanging from the connector, ending in a label that says what to do: Connect "Yes" to a step for a green check mark, Connect "No" to a step for a red cross, or Connect Start to a step. The block is outlined in red and the connector pulses, so it's easy to spot. To fix it, draw a line from that connector to the block that should come next.

In the example below, the red cross under "Large order?" has no line. Any order that arrives after 10am and is worth less than 500 has nowhere to go. The "Delivery in 3 days" block is on the canvas, but because nothing leads to it, it will never be used.

The "Large order?" condition with its red cross unconnected, marked with a red dashed line labelled Connect "No" to a step, and an unused "Delivery in 3 days" block shown faded

Loops

A loop is a line that leads back to a block Breww has already passed through on the same path, for example the red cross of a later condition drawn back up to the first one. Breww would go round in circles and never reach an outcome, so it treats a loop in the same way as a dead end.

The editor doesn't stop you drawing a loop, but it shows the line in red with a moving dash, and a label at its middle reads Leads back to an earlier step. To fix it, redraw the line to a block further along the path, or straight to an outcome.

A line from the red cross of "Large order?" back up to the earlier "By 10am?" condition, shown as a red dashed line labelled Leads back to an earlier step

Several lines leading into the same block is not a loop. In the worked example, both "yes" answers lead to "Next day delivery", and that's fine because neither line goes back to a block earlier on its own path.

Blocks that are never used

A block that no path from Start reaches is shown faded, with a dashed border and an amber label: Not connected - never used. Any blocks joined on after it are marked in the same way.

This is only a warning. Breww never reaches these blocks, so they can't cause errors and they don't bring up the red alert, even if their own connectors have no lines. They do make your rules harder to follow, though, so connect them or delete them.

What happens when Breww reaches a dead end or a loop

When Breww follows a path and finds nothing connected, or finds a line leading back to a block it has already passed through, it can't produce a result at all. It doesn't fall back to another outcome, and it doesn't skip the condition. Instead, it treats your rules as invalid for that particular order, product, purchase order or vessel.

These problems are easy to miss if you don't check the editor, because nothing goes wrong until something actually takes that path. Your rules can work perfectly for weeks, then fail on the first order that answers "no" to a question you never finished.

What you'll see depends on the rules:

  • Delivery rules: if your rules run when an order is confirmed, the order isn't confirmed and you'll see a message asking you to check your delivery rules. Elsewhere, such as when an order is paid in full or placed on your Trade Store, no delivery is scheduled. See Delivery rules for the full details.
  • Best before rules from packaging: Breww can't work out a best before date, so you'll need to enter it yourself when packaging, and labels are printed without one.
  • Best before rules from delivery: delivery labels show no best before date.
  • Purchase order approval rules: the purchase order can't be finalised, and you'll see an "Invalid purchase order approval rules" error.
  • Batch reading schedule rules: vessels show No rules instead of a reading schedule. See Batch reading schedule rules.

Checking your rules

After every change, glance at the top of the canvas before you rely on your rules. If the red alert is showing, press Show me and work through each problem until the alert disappears. Your rules are complete when there's no alert and no red markers left on the canvas.

If you're editing best before rules from packaging, the Best before date preview button above the canvas also helps. Any product without a date is one your rules don't currently cover.

Still stuck?

Tell us what you are stuck on.

These guides are written for the breweries who run Breww, so parts of them will describe screens you do not have. Send us the details and we will point you the right way.

Please use the routes above rather than replying to a sales email, support does not reach us that way.

Book a demo

Tell us where you are based so we can match you with the right person.

Loading...