Logic XOR Component
Use the Logic XOR (Exclusive OR) component to verify that exactly one of multiple conditions is met. This component is essential for scenarios where choices are mutually exclusive, ensuring that only one option is valid at a time.
Why this matters
What You’ll Configure
- Understand the Logic
- Provide Inputs
- Handle the Outputs
- Best Practices
- Troubleshooting Tips
- What to Try Next
Step 1: Understand the Logic
The component takes multiple inputs and provides two outputs: Verified
and Unverified
. The Verified
path is triggered only if exactly one input is true
. In all other cases (zero true
inputs, or more than one true
input), the Unverified
path is triggered.
In this context:
True
: Any input that has a value (e.g., a non-empty string, any number, the booleantrue
, an object, an array).False
: Any input that is empty,null
,undefined
, or the booleanfalse
.
Operational Rules
Input 1 | Input 2 | Verified Path (Outputs true ) | Unverified Path (Outputs true ) |
---|---|---|---|
True | True | Inactive | Active |
True | False | Active | Inactive |
False | True | Active | Inactive |
False | False | Inactive | Active |
Step 2: Provide Inputs
You can add two or more inputs to the component, each representing a condition to be checked for mutual exclusivity.
Action | Description |
---|---|
Add Input | Click the + icon to add a new input field. Give it a descriptive name that reflects the condition you are checking. |
Step 3: Handle the Outputs
The component has two output branches, allowing you to direct the workflow based on whether exactly one condition was met.
Output | Description |
---|---|
Verified | This path executes if one and only one of the inputs evaluates to true . |
Unverified | This path executes if zero inputs are true, or if more than one input is true. |
Branching Your Workflow
Best Practices
- Enforce Mutual Exclusivity: This is the primary use case. Use it to ensure a user has selected only one option from a list, or that a data record exists in only one of several possible states.
- Validate Configuration: Check that a system is configured with exactly one of several possible settings enabled.
- Distinguish from OR: Do not confuse
XOR
withOR
.OR
succeeds if at least one condition is true.XOR
succeeds only if exactly one condition is true.
Troubleshooting Tips
If your logic isn't branching as expected...
What to Try Next
- Create a sign-up flow where a user must provide either an email or a phone number, but not both, using
Logic XOR
to validate their input. - In a state machine, use
Logic XOR
to confirm that an item is in exactly one state (e.g., "Pending" XOR "Complete" XOR "Failed"). - Combine with other logic components to build complex validation rules, such as "(
A
XORB
is true) ANDC
is also true."