If@1
Node If@1
allows to execute a sub transformation pipeline based on a condition. The node evaluates a condition and if true, executes the nested transformations.
Adapter Prerequisites
- General availability: All adapters support this node type.
Node Configuration
For fields path
, see Overview.
Configuration Properties
Property | Type | Required | Description |
---|---|---|---|
path | string | Yes | Path to the value to compare in the data context |
operator | CompareOperator | No | Comparison operator (default: Equals ) |
value | any | No* | Static value to compare against |
valuePath | string | No* | Path to a dynamic value to compare against |
valueType | AttributeValueType | Yes | Data type of the values being compared |
transformations | array | No | Sub-pipeline executed when condition is true |
*Either value
or valuePath
must be provided (or both can be null for null checks).
Supported Operators
Operator | Description | Aliases |
---|---|---|
Equals | Checks if values are equal | Equal |
NotEquals | Checks if values are not equal | NotEqual |
Contains | Checks if string contains substring (case-insensitive) | Contain |
LessThan | Checks if value is less than comparison value | - |
LessEqualsThan | Checks if value is less than or equal | - |
GreaterThan | Checks if value is greater than comparison value | - |
GreaterEqualsThan | Checks if value is greater than or equal | - |
StartsWith | Checks if string starts with prefix (case-insensitive) | - |
EndsWith | Checks if string ends with suffix (case-insensitive) | - |
RegexMatch | Checks if string matches regular expression pattern | - |
Supported Value Types
Boolean
Int
(32-bit integer)Int64
(64-bit integer)Double
String
DateTime
Enum
(stored as integer)
Example: Simple Equality Check
transformations:
- type: If@1
path: $.customer.age
operator: Equals
value: 18
valueType: Int
transformations:
- type: SetPrimitiveValue@1
targetPath: $.customer.isAdult
value: true
Example: Range Check with Dynamic Value
transformations:
- type: If@1
path: $.product.price
operator: GreaterThan
valuePath: $.customer.budget
valueType: Double
transformations:
- type: SetPrimitiveValue@1
targetPath: $.warnings
value: "Product exceeds customer budget"
Example: String Contains Check
transformations:
- type: If@1
path: $.customer.email
operator: Contains
value: "@company.com"
valueType: String
transformations:
- type: SetPrimitiveValue@1
targetPath: $.customer.isEmployee
value: true
Example: Null Value Check
transformations:
- type: If@1
path: $.customer.middleName
operator: NotEquals
value: null
valueType: String
transformations:
- type: Simulation@1
simulations:
- targetPath: $.customer.fullName
simulatorKey: Person.FullName
Example: String StartsWith Check
transformations:
- type: If@1
path: $.product.sku
operator: StartsWith
value: "ELEC-"
valueType: String
transformations:
- type: SetPrimitiveValue@1
targetPath: $.product.category
value: "Electronics"
Example: String EndsWith Check
transformations:
- type: If@1
path: $.file.name
operator: EndsWith
value: ".pdf"
valueType: String
transformations:
- type: SetPrimitiveValue@1
targetPath: $.file.type
value: "Document"
Example: Regular Expression Match
transformations:
- type: If@1
path: $.customer.phone
operator: RegexMatch
value: "^\\+1[0-9]{10}$"
valueType: String
transformations:
- type: SetPrimitiveValue@1
targetPath: $.customer.region
value: "North America"
Behavior Notes
- String operators (
Contains
,StartsWith
,EndsWith
) perform case-insensitive comparisons - The
RegexMatch
operator uses standard .NET regular expression syntax and is case-sensitive - Comparison operators (
LessThan
,GreaterThan
, etc.) require comparable value types - Null values are properly handled in equality/inequality checks
- If the condition is not met, the sub-transformations are skipped and processing continues
- The data context is preserved after the conditional transformations complete
- For
RegexMatch
, escape backslashes must be doubled in YAML strings (e.g.,"\\d+"
for digit matching)