Using Conditions, you can add if/else logic to Triggers. 

You can think of conditions as a way to route an operator to a specific outcome depending on the trigger inputs. 

Tulip allows you to add a single or multiple conditions and to choose whether “all” conditions or “any” condition must be met to result in an action being triggered.

To create a Trigger with a condition, we first have to define an Event (e.g. a barcode is scanned by a connected barcode scanner). You can then select one of five Condition sources:

  • device
  • time fires
  • machine
  • step is opened
  • step is closed

You can do this using the "When" statement in the Trigger Editor.

Once you have selected the event, you must choose the type of value you will be checking.

Within the "If" statement, click "Add New Condition" on the right and choose from one of the four options.

  • A static value (User input).
  • An existing variable. Note: You must first create the variable for this.
  • A device output.
  • An expression

Then, you need to define the condition during the event required to trigger an output.  Available conditional operators in Tulip are:

  • Equals (=)
  • Greater than (>)
  • Greater than or equal to (≥)
  • Inside range ( Y<X<Z)
  • Is Blank (X=_)
  • Is Not Blank (X≠_)
  • Less Than or Equal To (≤)
  • Less Than (<)
  • Does Not Equal (≠)
  • Outside range (X<Y | X >Z)  

Note: The available operators depend on the type of values you are using for the condition.  

To complete a Trigger, create the desired action or actions in the "Then" section.

How to Create an Example Trigger with Conditions

In this example, we will test to ensure that measurements from connected calipers are in range:  

1. Open a step within the desired app in the Tulip App Builder. 

2. Select the Step Trigger by clicking on the plus icon in the Context Pane. 

3. Name the trigger by clicking title in the Trigger Editor.

4. Set the Event: 

  • Select “device” in the dropdown menu
  • Select “Caliper or Depth Gauge” in the second dropdown menu
  • Select “this station” in the third dropdown menu

5. Set a Condition:

  • Click the plus icon in the right side of the Conditions row.
  • Select “Device Output” in the dropdown menu
  • Select “data” in the dropdown menu
  • Select “Inside range” in the operator dropdown to make sure the output is within the desired range
  • Select “Static value” in the greater or equal to dropdown
  • Select “Number” and input the number 20.
  • Select “Static value” in the less than or equal to dropdown
  • Select “Number” and input the number 40.

6. Set an Action: 

  • Click the plus icon in the right side of the Actions row.
  • Select “Data Manipulation” in the dropdown menu
  • Select “Store”
  • Select “Device Output”
  • Select “Length measured”.
  • Select “New Variable” in the location dropdown menu and name new variable “In_Range”

Here's the full example from the Trigger Editor.

For more examples of commonly used triggers we recommend reading, "What are the 10 most commonly used triggers?"

Did this answer your question?