What is the syntax of IF plugin condition
Here are some examples of IF action plugin conditions.
- Simple condition with equals operator:
- Complex condition with AND:
- Complex condition with OR:
- BETWEEN condition:
- IS NULL condition:
- EXISTS condition:
- NOT EXISTS condition:
- Compound value in a function:
- Empty condition:
- Complex condition with nested parentheses:
- Complex condition that uses data functions.
(
payload@age > 18 AND
(
event@event_type == "click" OR
event@properties.action == "add_to_cart"
) AND
(
profile@data.pii.age > 25 AND
(
event@action == "purchase" OR
event@properties.action == "add_to_cart"
)
)
) OR (
(
payload@quantity BETWEEN 10 AND 50 OR
payload@timestamp BETWEEN 1631233200 AND 1631319600
) AND
(
payload@description IS NULL OR
event@type IS NOT NULL
) AND
(
event@properties.location EXISTS AND
profile@address NOT EXISTS
)
) AND (
(
memory@notes EMPTY OR
payload@items NOT EMPTY
) AND
(
payload@keywords CONTAINS "technology" OR
event@tags CONTAINS "important"
)
) AND (
(
payload@name STARTS WITH "John" OR
event@description ENDS WITH "exciting event"
) AND
(
event@participants[0] == "Alice" OR
event@ratings[2] >= 4.5
)
) AND (
now("europe/warsaw") > datetime("2021-01-01 00:00:00") AND
now("europe/london") < now.offset(payload@time, "+700 days")
)
-
CONTAINS Condition (contains string):
-
Check if keywords in payload contain "technology":
-
Check if event tags contain the word "important":
-
STARTS WITH/ENDS WITH String Conditions:
-
Check if payload name starts with "John":
-
Check if event description ends with "exciting event":
Remember, these examples follow the syntax you provided and assume that the specified fields like payload@keywords
, event@tags
, payload@name
, and event@participants[0]
, etc. exist in the data structure you're working with.