Product data rules¶
From version 3.8.3
This page describes behaviour available from client version 3.8.3. Sites on an earlier version do not have it yet.
The product template checks each value on its own: its type, length, list, unit and so on. Rules check values against each other, for example:
- the packed weight is at least the product weight;
- a product marked COSHH has a safety data sheet;
- the product weight is at most 50 kg.
Rules are kept on the Product Template page (/pim/template, the
Rules panel). Anyone using the PIM can see them; only superusers can add,
change or delete them, and every change is written to the audit trail.
How a rule works¶
A rule has a name, an optional message, and two lists of tests:
- When: every one of these must hold for the rule to apply. With none, the rule always applies.
- Then: every one of these must hold, or the rule is broken.
A test takes an attribute and one of these:
| Test | Compared with |
|---|---|
| is filled, is empty | nothing |
| is, is not, contains, starts with | a value or another attribute |
| is one of, is not one of | a list of values separated by \| |
| is more than, is at least, is less than, is at most | a number or date, or another attribute |
| is at most / at least this many characters | a number |
Numbers are compared as numbers. When both sides carry units of the same kind they are converted first, so 2.5 kg and 2500 g are equal. Dates are compared as dates, and anything else as text, ignoring case. Yes and no values match however they are written (yes, true, Y, 1). A list value matches by its code or its label.
A test against an empty value does not count. In When, it means the rule does not apply. In Then, it is not a breach. To require a value, use is filled.
Each rule is either:
- Warn: the breach is shown against the product but nothing is refused.
- Block the value: a value that would break the rule is refused when it is saved on the product's Template tab, and when it is loaded from a filled-in template workbook (the import report lists it against the product, and the product's other values still load). A product that already breaks a block rule can still have other values changed.
A rule can be switched off without deleting it.
Where rules apply¶
Rules belong to the site and apply to every template version that has all the attributes they name. A version without one of those attributes skips the rule. Breaches show on the product's Template tab with the rule's message, or a description of the broken test when there is no message.
A block breach counts as an error. It holds back the product's Data Level when the attribute it is shown against is needed for a level.
Try it in the rule editor runs the rule, saved or not, over a supplier's live products. It shows how many break it and lists the first of them, so a rule can be checked before it is switched on.
Rules do not change the scores on the Data Quality page, which has its own fixed rules.