Documentation
Getting Started
Data Grid
Modeling
Approvals
Users, Roles & Security
Administration
Integration & API
Installation
Migrating from MDS
Architecture
Documentation/Business Rules/Advanced IF/THEN Builder

Advanced IF/THEN Builder

Every rule is built from the same two halves. The Custom rule template starts you with both of them empty, so you can express conditions no single template covers — for example, "if Discontinued is false and the supplier is ACME or NORDIC, then LaunchDate must have a value."

Open it: Settings → Manage Models → [Entity] → Business Rules → Gallery → Custom rule.

The rule editor with a nested IF group: Discontinued is false, and any of Supplier is ACME or Supplier is NORDIC
The rule editor with a nested IF group: Discontinued is false, and any of Supplier is ACME or Supplier is NORDIC(click to enlarge)

The two halves

HalfLabel in the formWhat it holds
IFOnly whenConditions that must be true for the rule to apply. Each check names its own column.
THEN[Column] must satisfyThe assertion the row must pass. Every check tests the rule's own column.

Leave the IF half empty and the assertion applies to every row. That is a valid rule, not a mistake.

Building a group

Each group has a header:

  1. Match all / any of these — joins the checks with AND or OR.
  2. NOT — inverts the whole group.
  3. Check — adds one check to the group.
  4. Nested group — adds a sub-group, which starts on the opposite combinator.

Nest groups to express *(A AND B) OR (C AND D)*. There is no depth limit.

Watch it done in 5:43 — a custom rule nests groups with all and any, and asserts a range on a column its condition never touches:

Custom IF THEN business rules in Primentra

Comparing against something other than a value

Where a check takes one value, a second dropdown offers what to compare against:

  • a value — you type it.
  • another column — pick a column of the same data type in the same row.
  • today — date checks only.

Watch it done in 5:43 — a rule measures one column against another in the same row, then the flagged rows are worked through:

Compare two columns in one row with a business rule in Primentra

Checks by data type

The data type of the column decides which checks are offered.

Number (Int, Decimal)

CheckNotes
is between · is not betweenTwo values
is at least · is greater than · is at most · is less thanValue or another column
equals · does not equalValue or another column
is a multiple of
has at most … decimals
has a value · is empty

Watch it done in 5:30 — a Number limits rule sets a range, joins ranges with any, and switches from a warning to a refusal:

Number limits and ranges with business rules in Primentra

Text

CheckNotes
matches the formatA mask: A letter, 9 digit, * either
is between … characters · is at least … · is at most …Length
starts with · ends with · contains · does not contain
is one of · is none ofComma-separated list
equals · does not equalValue or another column
is uppercase · has no special characters
matches a regular expressionBrowser and API only — not enforced during an import
has a value · is empty

Date

CheckNotes
is after · is on or after · is before · is on or beforeValue, another column, or today
is betweenTwo dates
is in the past · is in the future
is within the last … · is within the next … · is at least … agoDays
is a working day
has a value · is empty

Watch it done in 5:38 — a Date limits rule refuses an opening date in the future or before 2000, and leaves an empty date alone:

Date rules — before, after, between and today in Primentra

Boolean and Domain

CheckNotes
is · is not
is one ofComma-separated list
has a value · is empty
Changing the column changes the data type, so the checks below it are reset. Build the column choice first.

A rule that can never pass

Primentra intersects the numeric ranges in an AND group before you save. Where two checks leave no number that satisfies both, a red banner appears — *This rule can never pass* — and the Save rule and Test rule buttons are disabled until you fix it. A range with its bounds the wrong way round is caught the same way.

The message

Leave Message shown to the user empty and Primentra uses the sentence shown under This rule reads. Fill it in to say something specific to your process. Only the message of the first failing error rule appears when a save is refused.

Ready to get started?

Start managing your master data with Primentra today.

View Pricing
Advanced IF/THEN Builder | Business Rules | Docs | Primentra