Skip to main content
This guide walks you through creating a decision table for a shipping charges calculation system. This approach is ideal for business rules that need to be managed by business analysts and subject matter experts without requiring programming knowledge.

Example Use Case: Enterprise Shipping Charges

Our enterprise shipping system has the following pricing rules:
  • Free shipping when:
  • The order has 4+ items AND the total is $300+
  • Standard shipping is selected (4-5 business days)
  • Otherwise, shipping charges vary based on:
  • Number of items
  • Delivery speed (Next day, 2nd day, or Standard)
  • Order total (less than 300or300 or 300+)

Version 1: Using Aletyx Playground

Step 1: Access Aletyx Playground

  1. Navigate to playground.aletyx.ai or run locally:
  1. From the welcome screen, click Create New Decision
  2. Name your new DMN “ShippingRules”, but you don’t have to do anything with it as we’re just going to use the Accelerators to speed up development!
  3. Apply the Decisions Kogito jBPM Profile Accelerator by clicking Apply Accelerator and selecting the profile.
  4. On the modal that pops up, click Apply.
  5. Make a commit message and click Commit
  6. Now you can either download your project by either clicking Share and select All Files to download the workspace or selecting your Git ID and creating a repository in your connected environment!

Step 2: Upload Decision Table Template

  1. Click Upload File in your project
  2. Download the Decision Table template
  3. Copy the template to your project

Step 3: Edit the Decision Table

  1. Open the uploaded Microsoft Excel® file in your preferred spreadsheet application
  2. Verify the RuleSet information is defined correctly:
  1. Review and modify the first RuleTable for orders under $300:
  1. Review and modify the second RuleTable for orders of $300 or more:
  1. Save the Excel file and upload the updated version to the playground

Step 4: Create Required Java Classes

Create two Java files in your project: Order.java
Charge.java

Step 5: Test Your Decision Table

  1. Click Deploy to create a dev deployment
  2. Once deployed, use the test interface to submit test orders:
  3. Order 1: 2 items, 150total,1daydelivery(Expectedcharge:150 total, 1-day delivery (Expected charge: 35)
  4. Order 2: 5 items, 400total,5daydelivery(Expectedcharge:400 total, 5-day delivery (Expected charge: 0 - free shipping)

Version 2: Java 17 Project with Maven

Step 1: Create a Maven Project

  1. Create a new Maven project with the following structure:
  1. Set up your pom.xml:

Step 2: Create the Model Classes

Create the Order and Charge classes in the ai.aletyx.model package as shown in the Playground version.

Step 3: Create the Decision Table

Create the Excel decision table as described above and save it to src/main/resources/rules/ShippingCharges.drl.xlsx.

Step 4: Create the Application Class

Create ShippingChargesApp.java:

Step 5: Build and Run the Application

  1. Build the project:
  1. Run the application:
  1. Follow the interactive prompts to test different orders:
  2. Try an order with 2 items, $150 total, Next Day delivery
  3. Try an order with 5 items, $350 total, Standard delivery

Benefits of Excel Decision Tables

  • Decision Analyst Friendly: Non-technical stakeholders can understand and modify rules
  • Centralized Rule Management: All business rules in one visible location
  • Easy Maintenance: Rules can be updated without code changes
  • Version Control: Excel files can be versioned alongside code
  • Rapid Iteration: Quick updates to business rules without recompilation