Add conditional column
The Add conditional column allows you to create a new column based on If...Then...Else schema with possibilities to add nested conditions in order to create conditional logic for data manipulation.
The condition is expressed in the if parameter with a condition object, which is the same object expected by the condition parameter of the filter step). Conditions can be grouped and nested with logical operators and and or.
The then parameter only supports a string, that will be interpreted as a formula (cf. formula step). If you want it to be interpreted strictly as a string and not a formula, you must escape the string with quotes (e.g. ‘“this is a text”’).
if...then...else blocks can be nested as the else parameter supports either a string that will be interpreted as a formula (cf. formula step), or a nested if if...then...else object.
Step parameters
New Column(string): Enter a name for the new column that will be created based on your conditions and formulas.If Condition: Define the condition(s) that will be evaluated.Then Formula: Specify the formula to be applied when the condition is true.Else Formula: Specify the formula to be applied when the condition is false.
Example
Input

Configuration
{
"new_column": "Category",
"if": {
"and": [
{
"column": "Price",
"operator": "ge",
"value": 50
},
{
"column": "Stock",
"operator": "gt",
"value": 10
},
]
},
"then" "Premium",
"else": "Standard"
}Where gt: greater than and ge: greater than or equal to
Output

Last updated
Was this helpful?