All decision models

Collections and nested data

Decision Model “Iterations”

Analyze employees, salaries, children, and locations by applying visible rules to collections of related business objects.

Business goals

Answer questions across a company’s employee data.

The model determines minimum or maximum salaries, total numbers of children, employee locations, and similar aggregate results. It is included in the standard installation as Iterations.

Iterations model business glossary
Glossary with Company, Employee, and Location conceptsOpen full size ↗

Data model

Represent Company → Employees → Locations.

The glossary defines Company with an Employee[] collection. Each Employee has name, age, gender, marital status, salary, number of children, and a Location[] collection. Location holds a unique identifier and address details.

Employee collection test data
Employee dataOpen full size ↗
Location collection test data
Location dataOpen full size ↗
Company test data that references employees
Company dataOpen full size ↗
Iterations model test cases and expected values
Test cases and expected valuesOpen full size ↗

Decision logic

Use four tables for four collection patterns.

  • Iterate through employees and flag those whose salary meets the high-salary threshold.
  • Aggregate the total number of children.
  • Stop an iteration after finding the first high-paid employee.
  • Use nested iterations to count employees at a selected ZIP code.
Iterations decision model table listing four decisions
Four coordinated decision tablesOpen full size ↗
Decision table iterating over high-paid employees
Iteration over EmployeesOpen full size ↗
Decision table aggregating the total number of children
Aggregate Total Number of ChildrenOpen full size ↗
Decision table that breaks after finding a high-paid employee
Iteration with a break conditionOpen full size ↗
Nested iteration over employees and their locations
Nested Employees → Locations iterationOpen full size ↗

Test and extend

Inspect the report, diagram, and related samples.

Run test.bat to execute the test cases and generate an explanation report. OpenRules Explorer produces the decision diagram.

  • AnalyzeEmployees
  • AnalyzeEmployeesWithoutLoops
  • AggregatedValues
  • MedicalServiceCoverage
  • ICD10
  • FlightRebooking
Iterations model Environment table
Environment tableOpen full size ↗
Iterations model explanation report
Generated explanation reportOpen full size ↗
Iterations decision diagram generated by OpenRules Explorer
Automatically generated decision diagramOpen full size ↗

Try the model yourself

Download OpenRules and run the samples.

The evaluation includes working decision projects that you can inspect, test, debug, and adapt.