multiConditional Documentation
Overview
The multiConditional Logic component is designed to evaluate each row of input data against a set of conditional rules, routing matching rows to specific output ports based on first successful matching conditions. It effectively allows for complex branching logic in data workflows, where unmatched rows can be routed to an "else" branch. Its efficiency in handling large datasets is significant, performing evaluations with linear complexity relative to the number of rules and rows.
Settings
The configuration for the multiConditional component is flexible and extensive, enabling users to define a variety of rules for data processing. Below are the detailed explanations for each setting.
Rules
- Setting Name:
rules- Input Type: Array of Objects
- Description: This setting defines the conditions used to evaluate the input rows. Each rule consists of three properties:
column,operator, andvalue. The first matching rule for each row determines its routing. - Default Value: Empty Array (
[]) - Effect of Changes: Adding or modifying rules will directly impact how input data is analyzed and routed. An increase in the number of rules can lead to more complex workflows and increase the chance of rows being routed to specific outputs based on the matching conditions.
- Example Rule Object Structure:
json
{ "column": "status", // The name of the column to evaluate "operator": "equals", // The condition operator (e.g., equals, greaterThan) "value": "active", // The value to compare against "label": "Active" // (Optional) A human-readable name for the rule }
Output Ports
The multiConditional component creates one output port for each rule defined in the rules array, along with a default "else" output for unmatched rows.
- Output Ports:
output1throughoutputN: Corresponds to each rule in order. These ports receive all rows that matched their respective condition.else: This port receives rows that did not match any defined rules.
How It Works
The multiConditional component processes input data in a step-by-step manner:
- Unwrapping Input Data: It extracts rows from the input data structure, ensuring it operates in an array format.
- Bucket Creation: It initializes output buckets corresponding to each rule and the "else" category.
- Rule Evaluation: For each row, it performs nested iterations over the defined rules:
- Checks if the row's value for the specified column meets the rule's condition using the designated operator.
- If a row matches a rule, it is routed to the corresponding output port, and the evaluation process stops for that row (first match wins).
- Rows that do not meet any condition are sent to the "else" bucket.
- Returning Results: Finally, the function wraps the results so that each output key maintains a consistent format,
{ data: [...] }.
Expected Data
Input Data Format
The multiConditional component expects the following structure for the incoming data:
- An array of objects, where each object represents a row of data that contains various fields. The rows may contain fields that align with the conditions specified in the
rules.
Example Input
[
{ "status": "active", "revenue": 1200 },
{ "status": "inactive", "revenue": 800 },
{ "status": "active", "revenue": 600 }
]Use Cases & Examples
Use Cases
-
Marketing Campaign Segmentation:
- Business analysts can use the
multiConditionalcomponent to segment customers based on their interaction status (active/inactive) and purchase history (revenue thresholds). This segmentation can aid in targeted marketing efforts.
- Business analysts can use the
-
Order Processing:
- E-commerce platforms can route order records based on payment status (paid/unpaid) and order value (high/low) to different processing workflows, ensuring that orders are handled according to their characteristics.
-
Customer Support Routing:
- Support platforms can evaluate incoming tickets based on urgency (high/low) and customer satisfaction levels, directing tickets to appropriate support channels based on defined criteria.
Configuration Example
Use Case: Segmenting active customers for a special promotion based on revenue.
Sample Input Configuration
{
"inputs": {
"input1": {
"data": [
{ "status": "active", "revenue": 1500 },
{ "status": "inactive", "revenue": 700 },
{ "status": "active", "revenue": 3000 },
{ "status": "active", "revenue": 900 },
{ "status": "inactive", "revenue": 2000 }
]
}
},
"config": {
"rules": [
{ "column": "status", "operator": "equals", "value": "active", "label": "Active" },
{ "column": "revenue", "operator": "greaterThan", "value": "1000", "label": "High Value" }
]
}
}Expected Output
Given the above configuration, the output could look like this:
{
"output1": {
"data": [
{ "status": "active", "revenue": 1500 },
{ "status": "active", "revenue": 3000 }
]
},
"output2": {
"data": []
},
"else": {
"data": [
{ "status": "inactive", "revenue": 700 },
{ "status": "active", "revenue": 900 },
{ "status": "inactive", "revenue": 2000 }
]
}
}In this example:
- The first output (
output1) includes rows of active customers with revenue over 1000. - The second output (
output2) is empty because no rows met the second rule. - The
elsebucket includes all rows that did not match any rules.
Additional Details
- AI Integrations: The
multiConditionalcomponent does not directly integrate with AI functionalities; however, it can be used in conjunction with AI models by filtering data in a preprocessing step before the data is fed into a machine learning model. - Billing Impacts: Utilization of the
multiConditionalcomponent can indirectly affect billing, as processing large datasets with numerous rules may consume more resources. Users should monitor their usage to optimize performance and cost.
This comprehensive documentation aims to provide a thorough understanding of the multiConditional Logic component, from its purpose and settings to practical applications in various business scenarios.