Decisions
The decision table puts business rules where the business can read them: inputs across
the top, answers on the right, one rule per row — who is approved, what a parcel costs, which team a
ticket goes to. Cells are written the way the DMN standard writes them (< 18,
[18..65), "UK", "IE", not(...)), or as spreadsheet formulas with the
inputs as names.
All seven DMN hit policies decide what happens when several rules match, including collecting answers and
adding them up. Try values and see which rule fired, which cell stopped each of the others, and why, in
plain sentences. Check finds the cases no rule covers and the rules that collide, and adds a rule for a
gap in one press. Test cases live with the table, and tables move to and from other rules engines as DMN
1.3 XML. Nothing is run with eval.
Loan pre-approval
Nine rules on credit score, employment and the loan against income — an input the table works out itself with a formula. Change the values under Try it, open Check to find the one case the rules forget, and Tests for the three cases kept with the table.
Get the code
<script src="/assets/bmx-components.min.js"></script> <bmx-decision-table id="dt-loan" style="inline-size: 100%"></bmx-decision-table>
Shipping charges, added up
Hit policy Collect – the sum: every rule that matches adds its charge. A base price by zone and weight, then express, fragile and heavy surcharges on top. Pick a parcel and see each part of the price.
Get the code
<script src="/assets/bmx-components.min.js"></script> <bmx-decision-table id="dt-ship" style="inline-size: 100%"></bmx-decision-table>
Routing support tickets
Hit policy Priority: several rules can match a ticket, and the one whose priority comes first in
the list (Urgent, High, Normal, Low) wins. Five tests sit with the rules, and one fails: an Enterprise
billing ticket should be High. Change rule 4's priority to High and watch the tests pass.
Get the code
<script src="/assets/bmx-components.min.js"></script> <bmx-decision-table id="dt-tickets" panel="tests" style="inline-size: 100%"></bmx-decision-table>
Rules from another tool
A DMN file written by another modelling tool, with FEEL in its cells and a calculation in one answer. Load it: the table reads it, turns the calculation into a formula, and says what it could not carry across. Or use Import DMN in the toolbar with a file of your own. Shown read only.
Get the code
<script src="/assets/bmx-components.min.js"></script> <bmx-decision-table id="dt-dmn" readonly panel="try" style="inline-size: 100%"></bmx-decision-table>
Ten thousand applications
The loan rules from the top of the page, run over ten thousand applications the page makes up. The rules are read once; each application is worked out in a few microseconds.
Get the code
<script src="/assets/bmx-components.min.js"></script> <bmx-button id="dt-batch" variant="soft">Run ten thousand applications</bmx-button>