Boolean ConditionControl the flow of execution within your workflow using different paths in an if/else manner
The 'Boolean Condition' connector on Tray allows you to make boolean comparisons between various types of data. This connector may be configured as a pure boolean logic gate, or to check that specific JSON paths exist in your workflow.
In the boolean condition we set up a series of one or more conditions. If those conditions are met then the steps on the “TRUE” branch will run. If they are not met then the steps on the “FALSE” branch will run instead.
Important note: If you delete a boolean condition connector it will delete all of the steps from its branches, too.
Conditions are made up of two values and a comparison type. We compare these two values to determine whether a condition is met - we call this whether the condition is “satisfied”.
Values can be any of the usual Tray types. You can compare, strings, numbers, booleans, objects and arrays. Also, you can set either of these values to be null. Usually both values will be of the same type.
Comparison types can be different depending on what you're comparing. Every comparison is either TRUE or FALSE.
Equality (Equal to / Not equal to)
Any type can be compared like this. It simply checks whether the values are the same.
- “Tray is awesome” Equal to “Tray is awesome”
- 5 Equal to 5
- “Up” Not Equal to “Down”
- True Equal to False
- 100 Equal to 2
- null Equal to “String”
Numerical Comparison (Smaller than / Smaller or equal than / Greater than / Greater or equal than)
These comparisons are used to compare numbers.
-5 Greater than 2
- 5 Greater or equal than 5
- 0 Smaller than 1
- 10 Smaller than 5
- 1 Greater or equal to 2
- 2 Greater than 2
Lists (In list/Not in list)
These comparison types are for determining whether a given value is in a list. For these comparison types the second of the two values needs to be an array. It will return TRUE if the value exists in the list and FALSE if it does not. If the second value is not an array then this will error. Strictness
Finally there is an option call strictness. This determines whether ALL of the conditions have to be satisfied or ANY of the conditions need to be satisfied. Theses are equivalent to AND and OR logical operations. If you select Satisfy ALL conditions then every one of the conditions needs to be satisfied in order for the workflow to follow the TRUE path. If you select Satisfy ANY conditions then only one of the conditions needs to be satisfied for the workflow to follow the TRUE path. Property Exists
The other operation available within the Boolean Condition connector is Property Exists. This takes a JSON path and returns true if the given path exists and it has a value. This is useful for checking that incoming data is valid before processing it.