Nected Docs
Try Nected For Free
  • 5 min QuickStart Guide
  • Getting Started
    • Introduction
    • Core Concepts
    • Use Cases
    • Tech Architecture
    • FAQs
  • INTEGRATIONS
    • Overview
    • Integrations Libraries
      • PostGres
      • MySQL
      • Oracle
      • MS SQL Server
      • Snowflake
      • MongoDB
      • RedShift
      • REST API
      • Google Sheets
      • Slack
    • Managing Integrations
  • DATASETS
    • Overview
    • Managing Dataset
  • Rules
    • Overview
    • Rule Types
      • SimpleRule
      • DecisionTable
      • Ruleset
      • Rule Chain
      • Decision Tree
    • Rule Conditions
    • Rule Actions
    • Concepts
      • Rule Result
      • Test & Publish Rules
    • Add Input Attributes
      • JSON Input Attributes
      • List Input Attributes
  • Triggers
    • Trigger Rule via API
    • Trigger Rule via WebHook
    • Trigger Workflow via API
    • Trigger Workflow via WebHook
    • Scheduler
    • Response Format
  • Workflow
    • Overview
    • Managing Workflow
    • Add Node
      • Action Nodes
        • Rule Node
        • Workflow Node
        • Custom Code Node
        • Database Node
        • REST API Node
      • Control Nodes
        • Loop Node
        • Delay Node
        • Response Node
        • Set Variables Node
        • Switch Block
    • Test & Publish Workflows
  • CODE AND DATABASE QUERIES
    • JavaScript Editor
    • Formula Editor
    • JSON Editor
    • List Editor
    • Excel-like Function
  • Embedded System
    • White-Labelling
    • Embeddable View
  • Self Hosting
    • Overview
    • Infrastructure Sizing
    • New Installation
      • Docker
      • Kubernetes
        • Set Up Kubernetes Cluster on AWS EKS
    • Additional Configuration
      • High Availability
      • Email Setup Guide
    • Upgrade Nected Version
  • Security
    • API Authentication
      • OAuth as part of Authentication under REST API
    • Role Based Access Control (RBAC)
    • SOC 2 Type 2, GDPR, ISO Compliance
  • Audit
    • Audit Trail
    • Approval Flow
    • Version Control & Rollback
    • Import/Export
  • Management API
    • Audit Log API
    • Global Variable API
  • References
    • Attribute Library
    • Global Variables
    • Pre-Configured Tokens
    • Pre-Configured Operators
    • NULL Value Handling/Behavior
    • Troubleshooting Errors
      • Multiple Tabs/Users Edits
      • Limits in Nected
    • Allowed Status Combinations
    • Environments
    • Usage Widget
    • Gen AI
  • ACCOUNT SETTINGS
    • Workspace Setting
      • Date Format and Timezone Settings
Powered by GitBook
On this page
  • Creating a Decision Tree Rule
  • Step 1: Adding Input Attributes
  • Step 2: Creating the Decision Tree Structure
  • Step 3: Adding more conditions
  • Step 4: Adding Results and Actions
  • Step 5: Publishing the Decision Tree
  • Version Control
  • Dependency Mapping
  • Conclusion
  1. Rules
  2. Rule Types

Decision Tree

PreviousRule ChainNextRule Conditions

Last updated 6 hours ago

DecisionTree is a powerful rule type in Nected that enables you to create complex branching logic for decision-making scenarios. Unlike linear rule evaluation, DecisionTree allows you to build hierarchical decision structures with multiple paths and outcomes based on various conditions. By utilizing switch blocks as decision nodes, you can construct multi-level trees that evaluate input attributes and route decisions through the most appropriate path based on your defined criteria.

Creating a Decision Tree Rule

To create the DecisionTree, just follow these simple steps:

Step 1: Adding Input Attributes

Before configuring your decision logic, you need to define the input attributes that will drive your DecisionTree. These attributes serve as the data points your conditions will evaluate against.

Input attributes can be sourced from two primary categories:

1. Static Values

  • Direct static values defined in the trigger node

  • Global variables are accessible across your rule

  • Values from the Attribute Library for standardized data points

2. Dynamic Values

  • Data fetched from (PostgreSQL, MongoDB, Google Sheets, and other supported databases)

  • Values retrieved through REST API nodes for real-time external data

To add input attributes:

  1. Navigate to the Input Attributes section

  2. Click "Add Attribute."

  3. Define the attribute name, data type, and source

  4. Configure the source settings based on whether you're using static or dynamic values

Step 2: Creating the Decision Tree Structure

Once you've defined your input attributes, you can begin building your decision tree logic. The DecisionTree utilizes switch blocks and variable management to create sophisticated branching decision paths.

Add Output Values

To add output values:

  1. Click the + icon in the rule designer

  2. Select "Set Variable" from the node list

  3. Define your output variables:

    • Variable name: Create meaningful names for your outputs (e.g., "approvedAmount", "riskScore", "eligibilityStatus")

    • Initial value: Set default values that can be updated later based on decision paths

    • Value source: Use static values, data from DB nodes, or values from input attributes

These output values will be available throughout your DecisionTree and can be updated at any point based on your business logic.

Create Conditions

With your output values initialized, you can now build the decision logic using switch blocks:

  1. Click on the + icon in the rule designer

The switch block serves as your decision branching mechanism, offering three key components:

IF Path Configuration

The IF path represents your primary condition branch. When configuring an IF path:

  1. Path Name: Enter a descriptive name in the path field to identify this decision branch (as shown in your UI where "Path" appears next to "IF")

  2. Condition Builder: Configure your condition by:

    • Property: Click the dropdown to select from your defined input attributes (e.g., cusID, creditAppl...)

    • Operator: Choose the appropriate comparison operator from the dropdown (Exists, Is Null, Equals, Greater than, etc.)

    • Value: Set the comparison value for your condition in the input field

Advanced Condition Options:

  • Multiple Conditions: To add additional conditions within the same IF path:

    • Click the "+ Add Condition" button below your existing conditions

    • Each new condition will be connected with an AND operator by default

  • Changing Logical Operators: To switch between AND/OR operators:

    • Click on the "And" dropdown button between conditions

    • Select either "And" or "Or" from the dropdown menu

    • This allows you to create complex logical expressions like "(A AND B) OR C"

  • Condition Groups: To organize multiple related conditions into groups:

    • Add multiple conditions first

    • Click the "+ Convert to group" button that appears next to conditions

    • This wraps selected conditions in a group, shown with a dotted border

    • Groups help manage complex logic by visually organizing related conditions

  • Nested Groups: For even more complex evaluation scenarios:

    • Within an existing group, click "+ Add Group"

    • This creates a nested group inside your current group

    • You can change the logical operator (AND/OR) at the group level using the dropdown

    • Each group can contain multiple conditions and subgroups

The UI provides visual hierarchy through indentation and borders to clearly show the relationship between conditions, groups, and nested groups.

ELSE IF Path Addition

To handle multiple decision scenarios, you can add ELSE IF paths:

  1. Click "Add ELSE IF" button to create additional conditional branches

  2. Each ELSE IF path provides the same configuration options as the primary IF path:

    • Custom Path Naming: Enter a descriptive name in the path field

    • Full Condition Builder: Access the same property, operator, and value selection interface

    • Multiple Conditions Support: Use the "+ Add Condition" button to add more conditions

    • AND/OR Operators: Click the logical operator dropdown to switch between AND/OR

    • Grouping Capabilities: Use "+ Convert to group" and "+ Add Group" for complex logic

You can add as many ELSE IF paths as needed to cover all decision scenarios in your tree. Each path evaluates independently and executes only when its conditions are met and previous conditions have failed.

DEFAULT Path Toggle

The DEFAULT path acts as a catch-all branch that executes when none of the defined conditions are satisfied:

  • Enable/Disable: Use the toggle to activate or deactivate the DEFAULT path

  • Purpose: Handles edge cases and ensures your DecisionTree always produces an outcome

  • Optional: You can disable the DEFAULT path if you want the tree to only execute when specific conditions are met

Step 3: Adding more conditions

Once done, we can create multi-level decision trees. To do this, follow the steps below:

  1. Nested Decisions: Within each path (IF, ELSE IF, or DEFAULT), you can add additional switch blocks to create deeper decision levels

  2. Path Continuation: Each decision path can lead to:

    • Another switch block for further branching

    • Action nodes for executing specific operations

    • Response nodes for returning results

Step 4: Adding Results and Actions

After configuring your decision tree structure and managing output values, you need to define how your DecisionTree returns results and performs actions based on the decisions made.

Adding Results with Response Node

The Response Node defines what data your DecisionTree returns after evaluation. This is where you structure the final output that will be sent back to the calling system or used by subsequent nodes.

To add a Response Node:

  1. At the end of each decision path, click the + icon

  2. Select "Response Node" from the node list

  3. Configure the response structure:

    • Response Format: Choose between JSON, text, or structured data

    • Response Data: Map your output variables and any additional data

    • Include Variables: Select which Set Variables should be included in the response

    • Add Custom Fields: Include any static or computed values in the response

  4. Structure your response to include:

    • Decision outcome (which path was taken)

    • Updated output values from Set Variable nodes

    • Any relevant input data that should be passed through

    • Metadata about the decision process if needed

Adding Actions

Beyond returning results, your DecisionTree can trigger actions to update systems or invoke external services. Actions are executed when specific decision paths are taken.

Database Actions with DB Node

To update database records based on your decision:

  1. Within any decision path, click the + icon

  2. Select "DB Node" from the node list

  3. Configure the database action:

    • Select Database: Choose from your configured database connections

    • Operation Type: Select INSERT, UPDATE, or MERGE

    • Target Table: Specify which table to modify

    • Field Mapping: Map your output values to database columns

  4. Define the query or operation:

    • For INSERT: Map all required fields for new record creation

    • For UPDATE: Specify the WHERE clause and fields to update

    • For MERGE: Define both matching criteria and update/insert logic

External Actions with REST API Node

To trigger external services or APIs:

  1. Within any decision path, click the + icon

  2. Select "REST API Node" from the node list

  3. Configure the API call:

    • Method: Choose GET, POST, PUT, PATCH, or DELETE

    • URL: Enter the API endpoint

    • Headers: Add any required authentication or content-type headers

    • Body: For POST/PUT requests, map your output values to the request payload

  4. Set up the request:

    • Authentication: Configure API keys, Bearer tokens, or Basic auth

    • Request Body: Use your output variables to construct the payload

    • Query Parameters: Add any required URL parameters

    • Error Handling: Define behavior for failed requests

Step 5: Publishing the Decision Tree

Before publishing your DecisionTree, ensure all components are properly configured and tested. If you're using any draft rules within your DecisionTree logic, make sure to update them to live versions before publishing.

Pre-publish Checklist:

  • Verify all draft rules are updated to live versions (either the latest live version or a specific live version based on your requirements)

  • Test all decision paths with representative data

  • Validate response nodes return expected results

Publishing Options:

  1. Publish in Production: To publish the DecisionTree directly to production, click the "Publish" button located in the bottom right corner of the rule designer.

  2. Request for Review: If your organization requires approval before publishing, you can assign a reviewer:

    • Click on "Request for Review" option

    • Select an approver from your workspace members

    • Add review notes if necessary

Version Control

Nected maintains a comprehensive version history for your DecisionTree rules. Each time you edit and re-publish a DecisionTree, a new version is created automatically. This versioning system allows you to track changes and rollback to previous versions when needed.

Accessing Version Control:

You can access the Version Control interface through two methods:

Method 1: Environment Tabs

  • Look at the top bar where you'll see environment tabs (Draft, Staging, Production)

  • Numbers displayed alongside each environment indicate the total versions available

  • Click on the respective environment tab to open the Version Control section

  • For example, "Production (3)" indicates three published versions in production

Method 2: Version Control Icon

  • Click the version control icon (located next to the settings icon)

  • This directly opens the Version Control section

  • View all available versions across different environments

Rolling Back Versions:

To revert to a previous version of your DecisionTree:

  1. Navigate to the Version Control section using either method above

  2. Locate the version you want to restore

  3. Click the "Rollback" button for that specific version

  4. Confirm the rollback action

Dependency Mapping

Decision Trees can be integrated into various workflows and systems within Nected. The Dependency Mapping feature helps you track where your DecisionTree is being used and what resources it depends on.

Accessing Dependency Map:

  1. Click on the dependency map icon (located below the Version Control icon)

  2. The Dependency Map section will open with two distinct tabs

Understanding Dependencies:

1. Using Tab This tab displays all the resources that your DecisionTree depends on:

  • Integrated data sources

  • Referenced rules or rulesets

  • Connected workflows

  • External API dependencies

  • Database connections used in dynamic value fetching

2. Used By Tab This tab shows where your DecisionTree is being utilized:

  • Workflows incorporating this DecisionTree

  • Other rules referencing this DecisionTree

  • Version information for each usage

  • Environment details (Production, Staging, etc.)

The dependency information is particularly valuable when planning updates, as it helps ensure changes to your DecisionTree won't unexpectedly impact other parts of your system.

Conclusion

The DecisionTree rule type in Nected provides a robust solution for implementing complex, multi-path decision logic. By combining the flexibility of switch blocks with the power of hierarchical decision structures, you can create sophisticated rules that handle diverse business scenarios efficiently.

With features like version control, dependency mapping, and comprehensive input attribute support, DecisionTree rules are well-suited for applications ranging from risk assessment and pricing calculations to approval workflows and recommendation engines. As you build your decision trees, remember to leverage the visual branching structure to create clear, maintainable, and scalable decision logic that grows with your business needs.

Before creating your decision conditions, you can define output values that will be populated based on your decision logic. The enables you to create and manage these output values dynamically.

Select the from the available node list

Note: When a DecisionTree is submitted for review, only the designated reviewer can publish it to production. Without a review request, you can publish directly using the Publish button. Learn more about the approval process in the documentation.

database nodes
Set Variable node
Switch Block
Approval Flow