Level 1: Branching and Boolean Conditions



Share A Little Information To Request Free Trial

Created with Sketch.

In this tutorial we're going to learn about how conditional connectors work in tray. A conditional connector is simply a connector that allows you to run a part of your workflow only some of the time based on some criteria you choose.

There are two kinds of conditional connectors: Boolean Condition and Branch. We're going to start with the Boolean Condition connector and we'll come back to Branch later.

Boolean Condition

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

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.

True Examples:

  • “Tray is awesome” Equal to “Tray is awesome”
  • 5 Equal to 5
  • “Up” Not Equal to “Down”

False Examples:

  • 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.

True Examples:

  • 5 Greater than 2
  • 5 Greater or equal than 5
  • 0 Smaller than 1

False Examples:

  • 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.


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.


The branch connector allows you to compare a single value against multiple different options and follow the branch that matches. Rather than just having a TRUE and a FALSE branch you can have as many branches as you like.

Value to test

First, define the value which will be compared to all of the others. This can be of any type. Note that the comparison is performed like the “Equal to” comparison from the Boolean Condition connector.


Each branch has a value and a label. The value is the value to be compared to the one in “Value To Test”. They will be compared and if they are equal then this branch will be taken. The label is used to show the name of the branch. You can define as many branches as you like using the “Add Branch” button.

That's everything there is to know about conditionals in Tray. A good next step is to try out some of this for yourself and then take a look at our tutorial on loops.

Last updated 15th September 2017


Share A Little Information To Request Free Trial

Created with Sketch.