The DMCommunity website regularly posts “challenges” through which decision management practitioners and vendors may compare their tools and solutions.  The September challenge shows off DMN and FEEL particularly well.

Here is the challenge, as stated:

A human resource office has information about all employees in every department including: salary, marital status, age, etc. Help the office to create a decision model that for each department calculates minimal, maximal, and average salaries along with a number of high-paid employees using rules like “Salary > 85000”.

My Solution

This is not really a business decision but calculations on tabular data that could be embedded in some larger decision logic.  The table provided omits a column for Department Number, so I added that, assigning the first 6 to Department 10 and the second 6 to Department 20.  The tool is Trisotech DMN Modeler with embedded RedHat Drools 7 for execution.

This is really about presentation of the results.  I chose a tabular breakdown of salary metrics by department and gender, and another by department and age category.  The DRD is shown above.  The input is specified as a zero-input decision, Employee Table.  Trisotech allows import of the table from Excel.  There is one adjustable parameter, High Salary Threshold.  I ran it with the suggested value $85,000.

Salaries by Gender is a context.  Context entry Table row is a function definition, with parameters genderClass and department.  Table row is a nested context, each context entry defining a column in the row.  The final result box of Salaries by Gender iterates Table row over each gender and department, creating the table.  Double iteration is supported by FEEL and by RedHat execution.

Salaries by Age is similar, except that here we need an additional function Age range to classify the employee age into one of 3 categories.  This is the first context entry.  Table row is similar to the one in Salaries by Gender, except that the logic now references the Age range function.  Again, the final result box performs double iteration to create the table.

Execution

Running the model in the tool gives the results below.

Want to learn how to create decision logic like this?  We cover everything used in this challenge in my DMN Method and Style Advanced training, which includes 60-day use of Trisotech DMN in my workspace and post-class certification.  Check it out!