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 expression to convert a string to lowercase:

  • LOWER('a string data type')

Expressions available in Tulip.

NameDescriptionInputsOutput
ABSReturns the absolute value of the inputn: Numberfloat
ADD_TIMEAdd a duration of time (e.g. days, weeks) to a Datetime.a: Datetime, b: Number, c: stringDatetime
ARRAYCONTAINSReturns true if the given value is in the given array, false otherwisearray: Array, v: Integer, Number, Text or Boolean
ARRAY_AVGReturns the average of a given numeric arraya: Array
ARRAY_CONCATConcatenates any number of arrays of a single type into a single array of that type
ARRAY_INDEX_OFReturn the index of a value for a given array. When the value occurs more than once, the first index will be returned.a: array, b: stringinteger
ARRAY_MAXReturns the maximum of a given numeric arraya: Array
ARRAY_MINReturns the minimum of a given numeric arraya: Array
ARRAY_STDEV_POPULATIONReturns the standard deviation of the population of a given numeric arraya: Array
ARRAY_STDEV_SAMPLEReturns the standard deviation of the sample of a given numeric arraya: Array
AVERAGEReturns the average of its argumentn: Integer or Number
AVERAGEFILTEREDReturns the average of its argument, filtered to completions matching the given conditionn: Integer or Number, condition: Boolean
AVGReturns the average of its argumentn: Integer or Number
AVGFILTEREDReturns the average of its argument, filtered to completions matching the given conditionn: Integer or Number, condition: Boolean
BADGE_ID_TO_USERConverts a badge id to a user objectbadgeID: Textuser
CEILRounds up to the nearest integern: Integer or Number
CONTAINSReturns whether or not a string contains a given substringstring: Text, substring: Textboolean
COSReturns the cosine of the given input in radiansn: Numberfloat
COUNTReturns the number of completions matching the given conditioncondition?: Boolean
COUNTOFCOMPLETIONSReturns the total number of completions.
ROUNDDATETIMETruncates a date to the given unitdate: Datetime or Date, truncation: Text, timezone (optional): Text
ENCODE_URIReturns a URL-encoded string version of a URI.component: Textstring
ENCODE_URI_COMPONENTReturns a URL-encoded string version of a URI component.component: Textstring
FILETOTEXTConvert from a File type to a Text string. *Behind the fileInTables feature flaga: filestring
FINDFinds the starting index of the given substring inside the given stringfind: Text, within: Textinteger
FLOORRounds down to the nearest integern: Integer or Number
DATETIMETOTEXTFormats a date to a string. Formatting:date: Datetime or Date, format: Text, timezone: Text
HEX_TO_INTReturns the numeric representation of the given hexadecimal stringhex: Textfloat
IFReturns the second argument if the first argument is true, or the third argument if the first argument is falsecondition: Boolean, valueIfTrue: T, valueIfFalse: T
INTERVAL_TO_SECONDSReturns the length of an interval in secondsinterval: Intervalfloat
INT_TO_HEXReturns the hexadecimal representation of the given numbern: Numberstring
ISEMPTYReturns True when an array does not contain valuesa: Arrayboolean
ISNULLReturns True if the value is NULLa: any data typeboolean
LEFTReturns a substring containing n characters starting from the lefttext: Text, n: Integerstring
LENReturns the length of the input stringtext: Textinteger
LINKReturns the first non-null argument. Takes any number of same-type arguments.
LOWERCASEConverts string to be all lowercases: Textstring
MAP_TO_BOOLEAN_LISTConverts an object array to base array for the given key
MAP_TO_INTEGER_LISTConverts an object array to base array for the given key
MAP_TO_NUMBER_LISTConverts an object array to base array for the given key
MAP_TO_TEXT_LISTConverts an object array to base array for the given key
MAXReturns the maximum of the given valuesa: Number, b: Numberfloat
MAXFILTEREDReturns the maximum of its argument, filtered to completions matching the given conditionn: Integer or Number, condition: Boolean
MAXIMUMReturns the maximum of its argumentn: Integer or Number
MAXIMUMFILTEREDReturns the maximum of its argument, filtered to completions matching the given conditionn: Integer or Number, condition: Boolean
MIDReturns a substring containing n characters starting from starttext: Text, start: Integer, n: Integerstring
MINReturns the minimum of the given valuesa: Number, b: Numberfloat
MINFILTEREDReturns the minimum of its argument, filtered to completions matching the given conditionn: Integer or Number, condition: Boolean
MINIMUMReturns the minimum of its argumentn: Integer or Number
MINIMUMFILTEREDReturns the minimum of its argument, filtered to completions matching the given conditionn: Integer or Number, condition: Boolean
NULLIFReturns null if the first argument equals the second argument, otherwise returns the first argument
TEXTTODATETIMEParses a datetime from text and format. Formatting:datetime: Text, format: Text, timezone (optional): Text
TEXTTOFILEParse a text url of a file to a Tulip File Type. *Behind the fileInTables feature flaga: textfile
POWReturns the first argument raised to power of the second argumentbase: Number, exponent: Numberfloat
RANDGenerates a random decimal number between 0 and 1float
RANDBETWEENGenerates a random number between (and including) the two numbers providedminimum: Integer, maximum: Integerinteger
RANDOMSTRINGReturns a random 17-character stringstring
RANDOM_COLORGenerates a random color
REGEX_MATCHReturns an array of matches to the regular expression
REGEX_REPLACEConverts a string to a new string by characters that match a REGEX patternsource: string, regex: string, replace: string, modifiers: stringstring
RGBReturns a color of the specified red, green, and blue componentsr: Integer, g: Integer, b: Integercolor
RGBAReturns a color of the specified red, green, blue, and alpha componentsr: Integer, g: Integer, b: Integer, a: Numbercolor
RIGHTReturns a substring containing n characters starting from the righttext: Text, n: Integerstring
ROUNDRounds a number to the specified number of digits, or the nearest integer if no digits providedn: Integer or Number, d?: Integer
SECONDS_TO_INTERVALConverts seconds into an intervalseconds: Integer or Numberinterval
SINReturns the sine of the given input in radiansn: Numberfloat
SPLITSplits text on the given delimiter
SQRTReturns the square root of a numbern: Numberfloat
TEXTTOIMAGEURLConverts a string into an image URLurl: TextimageUrl
SUBSTITUTEReplaces text from given string with another strings: Text, e: Text, n: Textstring
SUBTRACT_TIMESubtract a duration of time (e.g. days, weeks) from a Datetime.a: Datetime, b: Number, c: stringDatetime
SUMReturns the sum of its argumentn: Integer or Number
SUMFILTEREDReturns the sum of its argument, filtered to completions matching the given conditionn: Integer or Number, condition: Boolean
TANReturns the tangent value of the input in radiansn: Numberfloat
TEXTTOBOOLEANParses 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 falsen: Text
TEXTTOINTEGERParses text into a integern: Text
TEXTTONUMBERParses text or a timestamp into a numbern: Text
TOTEXTParses anything into textn: any
TRIMTrims the given character(s) from the ends of the given stringtext: Text, chars?: Textstring
UPPERCASEConverts string to be all uppercases: Textstring
USER_ID_TO_USERConverts a user id to a user objectid: Textuser

Tests

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

Requirements

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