Business rules and calculated data
Calculations are the heart of Vox. Many answers a business needs aren't typed in by anyone: whether a product can be sold in Denmark, which customers haven't ordered in two months, what delivery promise the app should show. Each is worked out from other data. In Vox these answers are calculated values. The team describes the rule once, for example by asking Studio for a calculated margin, and Vox works out the result for every record and keeps it current from then on.
Calculate a result once
Suppose a shop sells a product only if it has a valid price and a variant in stock for the selected market. The commerce team can agree on one availability rule. The storefront and the catalogue team can then work from the same answer.
The rule lives in Vox, not in the shop, the app, the feed and the report separately. Changing the rule changes the answer everywhere.
The result is saved on the product, customer or order like any other value. Lists can filter on it, and shops and exports read it without working it out again.
An information button next to a calculated field explains the rule, so an editor can see why a product isn't sellable or why an account is at risk.
Calculated values are read-only for editors. If a result looks wrong, the team corrects one of the values it depends on, such as the price, or changes the rule in Studio.
What a rule can produce
A rule isn't limited to one field on one record.
A product's margin, an account's revenue for the last twelve months, an order's total.
Sellable in Sweden but not in Denmark. A delivery promise for each country.
An order's discount spread across its lines, so each line shows its share.
A follow-up task, a renewal proposal or a replenishment request, created when the rule says one is needed.
Pass, warning or fail, with findings that explain it. See Data quality and readiness.
When an input changes
When the last blue rain jacket sells out, its quantity changes first. Vox follows the relationships used by the rule and updates the product's availability. Other products that share the same stock or price are updated too, so every result that depends on the change is brought up to date.
-
The warehouse reports zero stock
The stock level of the blue variant in the Copenhagen store changes from 1 to 0.
-
Vox finds the affected results
Vox remembers which values each result used last time. Only the jacket's availability read that stock level, so only the jacket is recalculated. The other ten thousand products are left alone.
-
The jacket's result changes
The jacket is no longer sellable in Denmark. Its history shows that the stock change caused the new result.
-
Channels get the new answer
The Danish shop and the partner feed receive the updated product.
The same happens for any kind of data. A payment arriving from the ERP updates the customer's overdue amount and health. A changed shipping policy updates the delivery promise of every product it covers.
A price import can affect thousands of products at once. Vox keeps every result up to date by recalculating the affected products in the background, while editors and shoppers carry on as usual.
Time is an input too
Some answers change just because time passes. A campaign price ends at midnight. A customer reaches 60 days without an order. A contract comes up for renewal next month. Vox notes each of these moments in advance and recalculates the record exactly then, without anyone saving anything. The arrival of a first price matters just as much as a price change, and a scheduled end matters just as much as an edit.
When the future is already known, Vox does better than recalculating at the moment. A Black Friday campaign saved on Monday is calculated into every affected price on Monday, as a price that changes over time: 1299 kr until midnight on the 27th, 999 kr until the 1st, then 1299 kr again. At midnight the new price simply applies, across 10,000 products at once, with nothing to run and nothing to wait for. Editors see the coming change on each product before it happens.
Rules that create work
A calculated value tells people what is true. A rule can also decide that something needs to be done, and create the record for it.
-
The condition becomes true
A wholesaler's account rule sees that Nordic Sport AB hasn't ordered in 60 days and has an overdue invoice.
-
The rule creates a task
It creates a follow-up task for the account manager. The task has a fixed identity per account and occasion, so recalculating the account again doesn't create a second one.
-
People take over
The account manager sees the task in their list, calls the customer and closes it.
A retailer can do the same for stock: when a store's stock of a product runs low, a rule requests replenishment. Because rules also run on drafts, a draft stock count shows the replenishment request it would lead to before the count is published.
Rules that apply policies
Many decisions follow from a policy the business has agreed: next-day delivery if ordered before 15:00, 30-day returns except for hygiene products, an age limit for certain categories. In Vox a policy can be a document of its own, edited in the admin by the team that owns it. Rules read the policy and apply it to every product, page or order it covers.
Imported data can be enriched this way too. Products imported from an existing PIM get a calculated delivery promise and return window next to the values the PIM sent. Shops and apps receive the result, not the policy. See the data and logic hub.
See the effects before publishing
Rules run on drafts as well as on published data. When the logistics team drafts a later cut-off time, or a category manager raises a category's age limit from 16 to 18, the draft shows which other records would get a different result before anyone publishes. See Drafts and publishing.
Change data together
A business action can check several values before accepting an edit. For example, a discount with an end date before its start date can be rejected while the editor is still working. Where several edits must succeed together, the model can define one operation for them.
Editors don't change records by editing raw data. They use actions, such as Rename, Change price or Close market, and each action can check its own rules. Vox checks a change at several levels:
- The field itself, for example a required name or a price that must be positive.
- The whole record, for example a campaign's end date that must come after its start date.
- Other data, for example a product number that must be unique across the catalogue.
A rejected change shows the editor which field to fix. When an operation touches several records, such as moving stock from one store to another, it can save all of them together or none of them.
Limits that hold under load
Some numbers are changed by many shoppers at once: the last pair of a shoe in one size, the money on a gift card, a newsletter code that can be used 1,000 times and once per customer. Vox keeps these as balances next to the record and checks every change against its limit in one step, so two checkouts can never both take the last unit, and a code is never used more times than it allows, however busy the shop gets.
Checkouts can also hold something for a while. A shop holds two pairs of shoes for fifteen minutes while the shopper pays, a payment authorizes 300 kr of a gift card and captures 250 kr when the order ships, and a claimed code use comes back by itself if the checkout is abandoned. Retries are safe, so a payment message that arrives twice is counted once. Support staff see each balance in the admin: what's on a gift card, how many uses a code has left and what's held for checkouts. Rules can read a balance too, eg to show a product as out of stock the moment the last unit is held.