This action allows you to branch depending on the state of the variables in the state

An example of the simplest configuration, the so-called "simple condition":

{
  "if": {
    "{{total}}>3": "gt3"
    }
}

Here we make one single condition - if the parameter is greater than a constant, the action will return an event

ЕIf you want to compare text placeholders with text values, then you need to enclose strings in 'single quotes' like this

{
  "if": {
    "'{{name}}'=='John'": "ok"
    }
}

<aside> 🚧 Date comparison, regexp, quantifiers and other comparison options are planned but not yet implemented, if you are missing some feature - write to us

</aside>

Action can also set other placeholders, for this use the parameter set

{
  "if": {
    "{{currency_mapped_obj.total}}>3": "gt3",
    "set": {
      "newplaceholder": "(({{currency_mapped_obj.total}}*2))"
    }
  }
}

You can also specify an unlimited number of ifelse blocks

{
  "if": {
    "{{currency_mapped_obj.total}}>3": "gt3",
    "set": {
      "newplaceholder": "(({{currency_mapped_obj.total}}*2))"
    }
  },
  "elseif": {
     "{{placeholder2}}!=1":"ne1"
  }
}

If you need to build the logic "AND" (all conditions are met) or "OR" (at least one of the conditions is met), simple conditions will have to be replaced with more complex constructions

{
  "if": {
    "and": [
      "{{currency_mapped_obj.total}}>=1",
      "{{currency_mapped_obj.total}}<=2"
    ],
    "event": "e2",
    "set": {
      "placeholder2": "e2"
    }
  }
}

Arrays are used

And all this can be combined into one big configuration

{
  "if": {
    "{{currency_mapped_obj.total}}>3": "gt3",
    "set": {
      "newplaceholder": "(({{currency_mapped_obj.total}}*2))"
    }
  },
  "elseif": {
    "and": [
      "{{currency_mapped_obj.total}}>=1",
      "{{currency_mapped_obj.total}}<=2"
    ],
    "event": "e2",
    "set": {
      "placee2": "e2"
    }
  },
	"else":{
		"event": "e3",
    "set": {
      "placee3": "e3"
    }
	}
}

Note: else not mandatory, it can never be used, because else will work if none of if or elseif

worked.