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 300+)
Version 1: Using Aletyx Playground
Step 1: Access Aletyx Playground
- Navigate to playground.aletyx.ai or run locally:
- From the welcome screen, click Create New Decision
- 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!
- Apply the
Decisions Kogito jBPM ProfileAccelerator by clickingApply Acceleratorand selecting the profile. - On the modal that pops up, click
Apply. - Make a commit message and click
Commit - Now you can either download your project by either clicking Share and select
All Filesto download the workspace or selecting your Git ID and creating a repository in your connected environment!
Step 2: Upload Decision Table Template
- Click Upload File in your project
- Download the Decision Table template
- Copy the template to your project
Step 3: Edit the Decision Table
- Open the uploaded Microsoft Excel® file in your preferred spreadsheet application
- Verify the RuleSet information is defined correctly:
- Review and modify the first RuleTable for orders under $300:
- Review and modify the second RuleTable for orders of $300 or more:
- 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.javaStep 5: Test Your Decision Table
- Click Deploy to create a dev deployment
- Once deployed, use the test interface to submit test orders:
- Order 1: 2 items, 35)
- Order 2: 5 items, 0 - free shipping)
Version 2: Java 17 Project with Maven
Step 1: Create a Maven Project
- Create a new Maven project with the following structure:
- Set up your
pom.xml:
Step 2: Create the Model Classes
Create the Order and Charge classes in theai.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 tosrc/main/resources/rules/ShippingCharges.drl.xlsx.
Step 4: Create the Application Class
CreateShippingChargesApp.java:
Step 5: Build and Run the Application
- Build the project:
- Run the application:
- Follow the interactive prompts to test different orders:
- Try an order with 2 items, $150 total, Next Day delivery
- 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