OpenRules Platform

Relational Database Integration

Rule DB – Unpaid Orders

The model combines database selection with business-owned alert rules based on total ordered amount, unpaid amount, and unpaid ratio.

The decision

Find essential unpaid orders and create alerts.

The model uses the classic MySQL Sample Database. SQL can find customers with unpaid orders, but the business objective is to produce alerts for essential orders based on total ordered amount and unpaid amount.

Classicmodels sample database diagram
Sample database organizationOpen full size ↗
SQL query that finds unpaid orders
Equivalent SQL queryOpen full size ↗
AddAlert business decision table
Business rules for unpaid-order alertsOpen full size ↗

Model the logic

Keep database selection separate from alert policy.

The UnpaidOrders DataSQL table selects records. Its glossary defines matching database attributes plus a Stats concept containing unpaid amount, unpaid ratio, and the resulting alerts.

DefineAlerts iterates over the selected orders, calculates decision variables, and invokes AddAlert. Supporting tables display the alerts and orchestrate the model.

UnpaidOrders DataSQL table
UnpaidOrders DataSQL tableOpen full size ↗
Unpaid Orders glossary
Business glossaryOpen full size ↗
DefineAlerts decision table
Calculate alert inputsOpen full size ↗
Unpaid Orders ShowResults table
Display generated alertsOpen full size ↗
Unpaid Orders main table
Main orchestration tableOpen full size ↗
Unpaid Orders Environment table
Model and database environmentOpen full size ↗

Run and explore

Generate alerts directly from relational data.

Start MariaDB and run test.bat to read the database and produce alerts. Run explore.bat to view the decision diagram and debug the model rule by rule and record by record. Business logic can change without modifying DataSQL or writing additional code.

Unpaid Orders execution results
Generated unpaid-order alertsOpen full size ↗
Unpaid Orders decision diagram
Decision model in OpenRules ExplorerOpen full size ↗

Try Rule DB

Build a decision model that works directly with your data.

The free evaluation includes Rule DB and ready-to-run database examples.