specs/models/M_TRIG

Triggers

Triggers are the core unit of user-definable logic in the Tulip system. Triggers wait for events to fire then they check various values and compare them inside clauses to determine whether to perform actions. This document describes triggers as they relate to Apps; Refer to Machine Triggers for triggers as they relate to machines.

Fields

NameDescription
EventThe event that the trigger executes in response to. See below for possible events.
ClausesThe logical operation the trigger performs before deciding if it should execute an action in response to the event. See below for possible clauses.
ValuesExisting data inside the Tulip system. An example value could be: "if the Tulip variable X is greater than 3" where X is the value. See below for possible values.
ActionsWhat the trigger does. Many actions are possible in the Tulip system. See below for possible actions.

Events

An event can result from multiple sources. Possible sources and examples below:

SourceExample
Physical interaction
  • Barcode being scanned by a USB barcode scanner
  • USB footpedalpressed
User interface interactiona user presses a virtual button inside of a Tulip App.
Time Interval60 seconds have elapsed since the App was started.
Machine EventA machine emits a state change event, e.g. The machine has stopped.

Clauses

Clauses allow users to define a series of boolean logic expressions (if/then statements) that must all evaluate to true before a given action is performed in response to a trigger event. A user can define a series of comparisons and then decide to execute a number of actions if one of the statements evaluates to true of if all of the statements evaluate to true.

Values

Values can be any data-store that is maintained in the context of an App execution. Values can come from a number of sources, including:

  • Table Record - A record placeholder holding the value of an entry in a Tulip Table. See Record Placeholder
  • Expression - An expression defined via the expression editor. See Expression Editor
  • Machine Activity Field - checks the up/down of a given machine.
  • Users - Values associated with a given Tulip user.
  • Static Value - Can be set to any unchanging value.
  • App Info - Set of information about the App itself.
  • Variable - A named value held in the given App context. Each variable has a type, see variables

Action

There are two categories of actions that triggers can cause: transition actions and regular actions. Transitions are changes to the flow state of the App. Transitions can occur by changing the current step, canceling the current App (resetting completion data) or completing the App. In a trigger there can only be one transition per action section. Once a transition has been executed by the App, any triggers for that same event will not fire. For example, if a user defines two separate triggers for a barcode scan and they both contain a transition, only the first to execute will be run.

Available transition actions:

  1. Go to step - Users can enter the step name or select next or previous as defined in the step list panel.
  2. Cancel App execution - current App context will be cleared and completion data will be reset.
  3. Complete App execution - current App context and execution state will be persisted. See completion.
  4. Change App - The ‘cancel App’ and ‘complete App’ actions both have an option to change Apps. If this action is selected the system will route to the App selected in the trigger. It will open the App to the version assigned at the station. If there is no assignment of the App at the station, then it will open the most recently published. If there is no published version then the system will error.

Available regular actions:

  1. Arrays
    • Clear array clears the values stored in an array value.
    • Concatenate array Combines a source array with a destination array value.
    • Get from index in array Gets the item at a specified index from an array value.
    • Get length of array Returns a number that corresponds to the number of items in the array.
    • Join to string Returns a string of all values combined by a specified delimiter.
    • Pop from array Returns the last item of an array and removes it from the array.
    • Push onto array Adds an item to the end of an array.
    • Set index in array Adds an item at a specified index. If there was already an item at that index it will be overwritten.
    • Add after index in array Add a new value after a specified index within an array variable
    • Remove element from array Remove an element at a specific index from an array
    • Remove and store element from array Remove an element at a specific index from an array and store it in a specific variable
    • Swap elements in array Swap the elements in an array at 2 given indices
  2. Data manipulation
    • Store in Variable - store a new value in the context of the current execution.
    • Increment Variable - increments a specified numeric value.
    • Decrement Variable - increments a specified numeric value.
    • Clear Variable - set a value to its initial zero-value.
    • Set Downtime Reason - set the reason a specified machine is down.
  3. Logout current user - logout the current user and cancel the current App execution.
  4. Open link - open a specified link in another window.
  5. Play sound - play a short audio snippet. Options include: Warning, Overtime, Doorbell, Three notes, Xylophone.
  6. Player menu - display player menu to a specific section. The 3 menu options are Open Comments Menu, Pause App, or Open Regular Menu.
  7. Scan optical barcode - triggers a scan action at a specified barcode.
  8. Print using system dialog - bring up the system print menu for the current step.
  9. Run connector function - users can select from one of the connector functions defined in the Tulip system, and specify which value to save the results to. For more information on connector functions see Connector functions.
  10. Run device function - users can select from the set of device integrations available in the Tulip system.
  11. Send email - sends an email to the user specified (with either a static value or user variable) with a specified message in the email body.
  12. Send SMS - sends an SMS to a specified user (with either a static value or user variable)with a specified message as the content of the SMS.
  13. Send SMS With Image - sends an SMS to a specified user with a specified message and a specified image as the content of the SMS.
  14. Show error - Brings up the error toast in the player with a specified message.
  15. Show message - Brings up the message toast in the player with a specified message.
  16. Split string - A function that takes two strings, the 'split' string and the 'by' string, and returns an array of strings that can be saved to a variable. The resulting array splits the split string by every instance of the by string.
  17. Table records - a collection of actions for how Apps utilize table 'record placeholders. See Record Placeholder

Tests

IDName
QA-T57Variable Widget : 02 - Record View: Compound variables can be used with triggers
QA-T62Variable widget : 07 - Testing variables and compound variables in app
QA-T98Record Placeholders : 00 - Load Table Records Trigger, and Table Record Widget
QA-T99Create and Load Table Record Trigger
QA-T100Record Placeholders : 00 - Table Data Tab
QA-T116Machine Monitoring : 06 - Machine Outputs
QA-T148Add Function to SQL Connector
QA-T183Triggers - Print Using System Dialog Trigger
QA-T235User Table : 01 - User Table
QA-T240Add several functions to HTTP Connector
QA-T258Machine Monitoring : 08 - App Triggers For Machines
QA-T352Triggers - Basic Triggers App
QA-T399Table Links : 03 - Linking Records via App Triggers