OpenRules Platform

Relational Database Integration

Rule DB – Evaluate Orders

This introductory example separates database-specific selection from business-owned calculations using DataSQL, a glossary, and ordinary decision tables.

The decision

Find high-value orders that are still in process.

The model uses the classic MySQL Sample Database. An equivalent SQL query would select customer orders with amount above 80,000 and status “In Process.”

Classicmodels sample database diagram
Sample database organizationOpen full size ↗
SQL query for high-value in-process orders
Equivalent SQL queryOpen full size ↗

Model the logic

Separate selection, concepts, and calculations.

The SelectedOrders DataSQL table handles record selection. Its matching glossary defines the selected-order attributes and the output concept Totals.

The DefineTotals table iterates over selected orders and accumulates their count and total amount. ShowResults prints the output, while the main table and Environment complete the model.

SelectedOrders DataSQL table
SelectedOrders DataSQL tableOpen full size ↗
Evaluate Orders glossary
Business glossaryOpen full size ↗
DefineTotals decision table
Calculate totalsOpen full size ↗
ShowResults table
Display the resultsOpen full size ↗
Evaluate Orders main table
Main orchestration tableOpen full size ↗
Evaluate Orders Environment table
Model and database environmentOpen full size ↗

Run and explore

Execute rules directly against the database.

Start MariaDB, then run test.bat. The model reads the database and prints its totals. Run explore.bat to see the decision diagram and execute the model rule by rule and record by record.

Database-specific selection stays in DataSQL, while business analysts can extend or change the business logic without programming.

Evaluate Orders test results
Execution resultsOpen full size ↗
Evaluate 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.