Operators
Conditional logic is based on the comparing of one value to another value. A condition is formed of a left side, an operator and a right side.
{Left Side} {OPERATOR} {Right Side}
The following operators can be used to create your condition. You can combine your conditions by using AND to require all conditions to be met before returning the return value. Alternatively if you need one condition to be met out of a group of conditions use OR.
Operator | Equation | Description |
---|---|---|
is equal to | X = Y | Both sides of the condition are the same. |
is not equal to | X != Y | Left side is not the same as the right side. |
is greater than | X > Y | Left side is greater than the right side. |
is greater than or equal to | X >= Y | Left is greater than or equal to the right side. |
is less than | X < Y | Left side is less than the right side. |
is less than or equal to | X <= Y | Left side is less than or equal to the right side. |
is empty | X === '' | The value being evaluated has no value |
is not empty | X !== '' | The value being evaluated has a value. |
contains | The left side contains the right side. If a check box question has been set on the left side the condition will be met if at least one of the check box option value selected by the customer matches the right side. In all other cases the condition will be met if the right side is entirely or partially within the left side value. | |
does not contain | The left side does not contain the right side. If a check box question has been set on the left side the condition will be met if no check box option value selected by the customer matches the right side. In all other cases the condition will be met if the right side is not matched to any part of the left side value. |
Comparing dates that don't include the time
Conditional logic can be used to compare dates. If the date definition doesn't include the time as part of the definition, the time will be set to 00:00:00 for comparison purposes.
Relative Date Comparison
If comparing two Date Calculation Definitions that use a relative date in the formula field are equal to each other the evaluated conditional logic may return a positive or a negative result depending on the current time each Date Calculation Definition evaluation was started. E.g. If the first relative date is evaluated and the time moves to the next second before the second relative date is evaluated the resulting comparison will result in a failure.
Date Format
The PHP DateTime object which is used when comparing dates interprets dates its passed to using US formatting when the date parts are separated by a forward slash /
. For example, 07/01/2020 is interpreted as 1st July 2020 not 7th January 2020. If alternatively the date passed is 23/01/2020 this would not be considered a valid date (there is no month 23) and the value is treated as a string in the logic.
To compoare a date you should ensure the format of the date is in YYYY-MM-DD
format to avoid unexpected bahaviour. You can use the Date plus/minus days
logic to convert the format of a date to this format if required. The date component stores its value in YYYY-MM-DD
format and does not need to be converted.