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:
Expressions are defined locally- they exist within the Trigger or Analysis where they are defined.
An expression can be in one of two states:
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
| Function Name | Description | Inputs | Outputs |
|---|---|---|---|
| ABS | Returns the absolute value of the input | ||
| ARRAY_CONCAT | Concatenates any number of arrays of a single type into a single array of that type | ||
| ARRAYCONTAINS | Returns true if the given value is in the given array, false otherwise | ||
| ARRAY_MIN | Returns the minimum of a given numeric array | ||
| ARRAY_MAX | Returns the maxumum of a given numeric array | ||
| ARRAY_AVG | Returns the average of a given numeric array | ||
| CEIL | Rounds up to the nearest integer | ||
| CONTAINS | Returns whether or not a string contains a given substring | ||
| COS | Returns the cosine of the given input in radians | ||
| DATE_TRUNC_TZ | Truncates a date to the given unit | ||
| FORMAT_DATE_TZ | Formats a date to a string. Formatting: devhints.io/moment | ||
| FLOOR | Rounds down to the nearest integer | ||
| FIND | Finds the starting index of the given substring inside the given string | ||
| HEX_TO_INT | Returns the numeric representation of the given hexadecimal string | ||
| IF | Returns the second argument if the first argument is true, or the third argument if the first argument is false | ||
| INT_TO_HEX | Returns the hexadecimal representation of the given number | ||
| LINK | Returns the first non-null argument. Takes any number of same-type arguments. | ||
| LOWERCASE | Converts string to be all lowercase | ||
| LEFT | Returns a substring containing n characters starting from the left | ||
| LEN | Returns the length of the input string | ||
| MAX | Returns the max value of two numbers | ||
| MID | Returns a substring containing n characters starting from start | ||
| MIN | Returns the min value of two numbers | ||
| NULLIF | Returns null if the first argument equals the second argument, otherwise returns the first argument | ||
| PARSE_DATETIME_TZ | Parses a datetime from text and format. Formatting: devhints.io/moment | ||
| PARSEBOOLEAN | Parses 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 | ||
| PARSEFLOAT | Parses text or a timestamp into a float | ||
| PARSEINTEGER | Parses text into a integer | ||
| PARSETOTEXT | Parses any value into a text value | ||
| POW | Returns the first argument raised to power of the second argument | ||
| RAND | Generates a random decimal number between 0 and 1 | ||
| RANDBETWEEN | Generates a random number between (and including) the two numbers provided | ||
| RANDOM_COLOR | Generates a random color | ||
| RANDOMSTRING | Returns a random 17-character string | ||
| ROUND | Rounds a number to the specified number of digits, or the nearest integer if no digits provided | ||
| RIGHT | Returns a substring containing n characters starting from the right | ||
| REGEX_MATCH | Returns an array of matches to the regular expression | ||
| SIN | Returns the sine of the given input in radians | ||
| SQRT | Returns the square root of a number | ||
| SUBSTITUTE | Replaces text from given string with another string | ||
| SPLIT | Splits text on the given delimiter | ||
| TAN | Returns the tangent value of the input in radians | ||
| TRIM | Trims the given character(s) from the ends of the given string | ||
| UPPERCASE | Converts string to be all uppercase | ||
| USER_ID_TO_USER | Convert an alphanumeric user ID string into a variable of type "User" | ||
| SECONDS_TO_INTERVAL | Convert an integer value into an interval value and store it in an interval variable |