FormulasBeta
The Print MIS formula language and its two editors — a code expression editor and a drag-and-drop block builder — with the complete reference of variables, operators, and functions.
Formulas are what make Print MIS pricing adaptable to how your shop actually works. Nearly every value in a configuration that isn't a fixed setting is a formula: a variable's expression, a process step's run speed or waste percentage, the amount of a material an option consumes, the seed for a margin calculation, and the conditions that show or hide an option. They all share one small, purpose-built language, and the same engine evaluates them in the admin's live preview, on the storefront calculator, and in the server-side check at checkout — so a formula behaves identically everywhere.
A formula always produces a single value — a number in almost every case. Comparisons and logical functions produce 1 for true and 0 for false, which you combine with IF and arithmetic to express conditional pricing.
Two ways to author a formula
Every formula field can be edited in either of two modes, and the choice is made per field — you can write some formulas as code and build others from blocks within the same configuration. The two editors are just different surfaces over the same stored formula; switching modes never changes what a formula means.
Code expression editor
Type formulas directly with syntax highlighting, context-aware autocomplete, and inline error checking — fast and precise for anyone comfortable with spreadsheet-style expressions.
Block editor
Assemble formulas from labeled, snap-together blocks with dropdowns for variables and tables — no syntax to memorize and no way to mistype a name.
Code expression editor
The code editor is the default. It's a full formula code editor — the same kind of assistance you'd expect when writing code — tuned specifically to the Print MIS language:
- Syntax highlighting colors numbers, text, variables, functions, and operators so the structure of a formula is easy to read at a glance.
- Autocomplete suggests what's valid at the cursor. It knows which variables are in scope at that specific field, lists the built-in functions with their signatures (for example
IF(condition, then, else)andCEIL(value, precision)), and — inside aLOOKUP— offers the names of the lookup tables you've defined. This means you rarely type a variable or table name by hand. - Inline error checking underlines a syntax mistake — a missing parenthesis, an unknown function, an unterminated bracket — the moment you make it, with the reason on hover, so you don't have to save and reprice to find a typo.
The field starts as a single line and grows as a formula gets longer, so short formulas stay compact while complex ones remain readable.
Block editor
Switching a field to the block editor replaces the text box with a visual canvas where a formula is built from interlocking blocks — one block per piece of the language. Drag an IF block out, drop a comparison into its condition, drop a number and a variable into its branches, and you've built IF(Qty > 500, 0.04, 0.05) without typing any syntax.
The block editor is designed to remove the two most common authoring mistakes:
- Variables are dropdowns, not text. A variable block lists exactly the names that are valid at that field, so you can't misspell one or reference something out of scope.
- Lookup tables are dropdowns too. A
LOOKUPblock picks its table from the list of tables you've defined, instead of a typed-in name.
Blocks for functions that take any number of inputs — AND, OR, MIN, MAX, SUM — let you add and remove input slots as needed. Block colors group the language by purpose (variables, arithmetic, logic, lookup) to keep large formulas legible.
Because every block corresponds to a piece of the formula and vice-versa, you can move a formula between the two editors freely. One thing to note: opening a typed formula in the block editor and switching back normalizes its spacing to a standard form (for example IF( Qty>1, 100,0 ) becomes IF(Qty > 1, 100, 0)). The formula's meaning is unchanged.
The code editor catches syntax problems as you type. Errors that only appear when a formula actually runs — referencing a variable that isn't available at that point, or dividing by zero for a given input — surface in the configuration's live Preview tab, where you can sample-price real inputs.
Values you can use
Built-in inputs
Every formula can reference the job's core inputs without defining them first:
| Value | Meaning |
|---|---|
Qty | The order quantity. |
Width / Height | The finished dimensions. |
Area | The finished area (width × height). |
FrontColors / BackColors | The number of colors on each side. |
PageCount | The number of pages. |
Configuration values
Beyond the built-ins, formulas can reference the values your configuration defines:
- Variables from the Variables tab, by name — but only those evaluated before the current one, so references always flow forward.
- Options, by name — and for variable-driven options, the selected item's cost and unit are available as companion values.
TotalRunningTotal— the accumulated cost so far — available inside process-step formulas.
Names are not case-sensitive, so Qty, qty, and QTY all refer to the same value. A name that contains spaces or punctuation is wrapped in square brackets, which lets you compare against option names directly — for example [Number of Pockets] = "2 Pockets".
Language reference
Numbers and text
Formulas work with numbers (whole or decimal, like 12 or 0.045) and text (in double quotes, like "Gloss"). Text is used for comparing against option selections and for naming lookup tables; arithmetic and the ordering comparisons work on numbers only.
Operators
| Operator | Purpose | Notes |
|---|---|---|
+ - * / | Add, subtract, multiply, divide | Numbers only. Dividing by zero is an error. |
- (in front of a value) | Negate | e.g. -Width |
= != | Equal / not equal | Works on numbers and text. Returns 1 or 0. |
< > <= >= | Less / greater than (or equal) | Numbers only. Returns 1 or 0. |
Operators follow ordinary math precedence — multiplication and division before addition and subtraction — and you use parentheses to group: (Width + 2) * Height. A comparison produces 1 or 0, which you feed into IF or combine with the logical functions below. There is no exponent, remainder, or text-joining operator — those aren't part of the language.
Functions
Function names are not case-sensitive. Arguments are separated by commas.
| Function | Returns |
|---|---|
ABS(x) | The absolute (non-negative) value of x. |
MIN(a, b, …) | The smallest of its arguments. |
MAX(a, b, …) | The largest of its arguments. |
SUM(a, b, …) | The total of its arguments. |
ROUND(value, decimals) | value rounded to the given number of decimal places — ROUND(12.346, 2) → 12.35. |
FLOOR(value, step) | value rounded down to the nearest multiple of step — FLOOR(13, 4) → 12. Useful for whole sheets or imposition counts. step must be positive. |
CEIL(value, step) | value rounded up to the nearest multiple of step — CEIL(13, 4) → 16. |
IF(condition, then, else) | then when the condition is true, otherwise else. Only the chosen branch is evaluated. |
NOT(x) | 1 when x is false (zero/empty), otherwise 0. |
AND(a, b, …) | 1 only when every argument is true. |
OR(a, b, …) | 1 when any argument is true. |
LOOKUP(value, "TableName") | A value pulled from one of your lookup tables. |
FLOOR and CEIL round to a multiple, not to decimal places — the second argument is the step size. To round to a number of decimals, use ROUND.
Lookups
LOOKUP reads a value out of a table you've defined on the configuration's Lookup Tables tab, and how it matches depends on the table's key type:
- Number-keyed tables match by tier:
LOOKUPreturns the value for the largest key that is less than or equal to your value. A table keyed1 → 0.10,500 → 0.08,1000 → 0.06returns0.08forLOOKUP(750, "Discounts"). (Asking for a value below the smallest key is an error.) - Text-keyed tables match exactly: the value must equal one of the keys.
This makes lookups the natural way to express quantity-break pricing, setup charges by color count, or any stepped rate that's easier to maintain as a table than as a chain of IFs.
A worked example
A per-step material consumption formula that takes the finished area, adds a 5% waste allowance, and rounds up to whole sheets:
CEIL(Area * 1.05, 1)A margin seed that gives a quantity break using a lookup table, with a floor:
MAX(LOOKUP(Qty, "QtyDiscount"), 0.05)Both read top-to-bottom the same way the engine evaluates them — and both can be built block-by-block in the block editor if you'd rather not type them.