specs/models/M_EXPRESSION

Expressions

Expressions are predefined calculations that take inputs matching a data type and return outputs matching a data type.

Expressions in Tulip differ from expressions as a general concept because they utilize specific Tulip data types, such as a user.

Their syntax (the way they are created) resemble functions from Microsoft Excel.

Expressions are used in the following Models:

  • Triggers: An expression can be used within a trigger action when it is executed in the Tulip Player. It is defined by an app builder.
  • Analysis: An expression can be used to define a configurable field on an Analysis. It is executed every time the Analysis refreshes with new data.

Expressions are defined locally- they exist within the Trigger or Analysis where they are defined.

An expression can be in one of two states:

  • Success: The expression will properly calculate data and can be saved in Tulip
  • Failure: The expression will not properly calculate data and cannot be saved until it is fixed or deleted.

An example of an expression is this OEE calculation:

round((((sum(parsefloat(@Uptime Duration )) / sum(parsefloat(@Duration ))) (sum(@Part Count ) - sum(@Defect Count ))) / sum(@Part Count )) sum(@Part Count / @Parts Per Hour ) (3600 / sum(parsefloat(@Duration ))) 100, 1) + '%'

The expression above calculates OEE over the time frame in the Analysis

Expressions avaiable in Tulip.

Function NameDescriptionInputsOutputs
ABSReturns the absolute value of the input
ARRAY_CONCATConcatenates any number of arrays of a single type into a single array of that type
ARRAYCONTAINSReturns true if the given value is in the given array, false otherwise
ARRAY_MINReturns the minimum of a given numeric array
ARRAY_MAXReturns the maxumum of a given numeric array
ARRAY_AVGReturns the average of a given numeric array
ARRAY_STDEV_SAMPLEReturns the standard deviation of a sample of a given numeric array
ARRAY_STDEV_POPULATIONReturns the standard deviation of the population of a given numeric array
CEILRounds up to the nearest integer
CONTAINSReturns whether or not a string contains a given substring
COSReturns the cosine of the given input in radians
DATE_TRUNC_TZTruncates a date to the given unit
FORMAT_DATE_TZFormats a date to a string. Formatting: devhints.io/moment
FLOORRounds down to the nearest integer
FINDFinds the starting index of the given substring inside the given string
HEX_TO_INTReturns the numeric representation of the given hexadecimal string
IFReturns the second argument if the first argument is true, or the third argument if the first argument is false
INT_TO_HEXReturns the hexadecimal representation of the given number
LINKReturns the first non-null argument. Takes any number of same-type arguments.
LOWERCASEConverts string to be all lowercase
LEFTReturns a substring containing n characters starting from the left
LENReturns the length of the input string
MAXReturns the max value of two numbers
MIDReturns a substring containing n characters starting from start
MINReturns the min value of two numbers
MAP_TO_BOOLEAN_LISTConverts an array of objects to an array of booleans
MAP_TO_NUMBER_LISTConverts an array of objects to an array of numbers
MAP_TO_INTEGER_LISTConverts an array of objects to an array of integers
MAP_TO_TEXT_LISTConverts an array of objects to an array of text values
NULLIFReturns null if the first argument equals the second argument, otherwise returns the first argument
PARSE_DATETIME_TZParses a datetime from text and format. Formatting: devhints.io/moment
PARSEBOOLEANParses text into a boolean. “y”, “yes”, “t”, “true”, and “on” (and any capitalized variants) are recognized as true, and “n”, “no”, “f”, “false”, and “off” are recognized as false
PARSEFLOATParses text or a timestamp into a float
PARSEINTEGERParses text into a integer
PARSETOTEXTParses any value into a text value
POWReturns the first argument raised to power of the second argument
RANDGenerates a random decimal number between 0 and 1
RANDBETWEENGenerates a random number between (and including) the two numbers provided
RANDOM_COLORGenerates a random color
RANDOMSTRINGReturns a random 17-character string
ROUNDRounds a number to the specified number of digits, or the nearest integer if no digits provided
RIGHTReturns a substring containing n characters starting from the right
REGEX_MATCHReturns an array of matches to the regular expression
SINReturns the sine of the given input in radians
SQRTReturns the square root of a number
SUBSTITUTEReplaces text from given string with another string
SPLITSplits text on the given delimiter
TANReturns the tangent value of the input in radians
TRIMTrims the given character(s) from the ends of the given string
UPPERCASEConverts string to be all uppercase
USER_ID_TO_USERConvert an alphanumeric user ID string into a variable of type "User"
SECONDS_TO_INTERVALConvert an integer value into an interval value and store it in an interval variable
RGBConverts a color specified with an RGB() function into a hex code so it can be stored in a Color variable
RGBAConverts a color specified with an RGBA() function into a hex code so it can be stored in a Color variable

Tests

IDName
QA-T497Expression Editor : 01 - Create an expression in an app trigger
QA-T521Expression Editor : 02 - Running the "Expressions" app

Requirements

IDRequirement
75Ability to send notifications from any content screen. Ie. email, txt message, alarms.
190Ability to define a UoM and the conversion formulas and rules between UoMs