Flows @ Functions
Functions allow you to automate certain calculations and can be added wherever there is an input box. Functions all begin with an @ symbol followed by the name of the function and any parameters required within brackets.
Time based functions
The following functions will be replaced by an offset that is automatically used by the Flows engine to correspond to a time.
@NowSeconds() | Unix time now, in seconds |
@NowMinutes() | Unix time now, in minutes |
@NowMilliseconds() | Unix time now, in milliseconds |
@EndOfDay() | Calculates the time difference between NOW and the end of the day. Useful for timers. |
@24Hours() | Calculates 24 hours from now, useful for timers |
@1Hour() | Calculates 1 hour from now, useful for timers |
@5Mins() | Calculates 5 minutes from now, useful for timers |
@NextMonday6am() | Calculates the interval to ‘next Monday at 6am’. Helpful for timers |
@StartNextMonth() | Calculates the interval to the start of next month at midnight. |
@5Days() | Calculates the interval to 5 days exactly from now, based on the time now. |
@7Days() | Calculates the interval to 7 days exactly from now, based on the time now. |
@14Days() | Calculates the interval to 14 days exactly from now, based on the time now. |
@21Days() | Calculates the interval to 21 days exactly from now, based on the time now. |
All time functions with the exception of @NowSeconds & @NowMilliseconds returns an offset in minutes and can also be used further in calculations. For example: @EndOfDay() + ( 60 * 3 ) Will equate to 3am on the following day.
String and other functions
@flowid() | Returns the flowId for a given flow. |
@guid() | Returns a randomly generated GUID |
@default( variable, default ) | Checks to see if variable exist and returns the value of default if it doesn't @default(value,) <- Return blank if not set @default(maxValue,10) <- returns '10' unless maxValue is set |
@ifSet( variable, string) | If the variable is set then the second parameter is returned, otherwise nothing is returned @ifSet(user,Hello {{user}}) <- Hello Mike @ifSet(notExists,Hello {{user}}) <- blank |
@touppercase( string ) | Converts the given string to upper case. |
@tolowercase( string ) | Converts the given string to lower case. |
@tostring( variable ) | Converts the given variable to a string, such as a number. |
@length( variable ) | Returns the length of characters for the given variable. |
@startswith( variable, search ) | Returns true if the variable given starts with the given search variable. Otherwise, it returns false. |
@endswith( variable, search ) | Returns true if the variable given ends with the given search variable. Otherwise, its returns false. |
@subStr( variable, start, length) | Returns the substring of the variable. The start is zero based, and length represents the number of chars to return. @subStr(Hello World,6,5) <- World |
@calc( formula ) | Calculate an equation given by formula. This can also be done using the = operand. =2+1 and @calc(2+1) |
@bigcalc(formula ) | Calculate an equation given by formula. This can also be done using the = operand. It handles arbitrary-precision decimal numbers, where calculations require a high degree of accuracy and consist of very large or very small numbers. |
@randomString( length ) | Creates a random string of characters. Length must be between 1 and 100. |
@randomint( length ) | Creates a random numner of characters. Length must be between 1 and 100. |
@encode64( string ) | Encoding the string in Base64 |
@encodePad64( encode ) | Same as encode64, but pads to the 3 byte boundary as required. |
@sha1(string ) | Encodes the string using SHA-1 |
@sha256( string ) | Encodes the string using SHA-256 |
@md5( string ) | Encodes the string using MD5 |
@formatDate( variable, format ) | Formats the unix second variable passed in to the format provided. Examples @formatDate(<value>,yyyy-MM-dd HH:mm:ss) => 2022-09-22 04:32:33 @formatDate(<value>,yyyy MMM dd) => 2022 Sept 22 |
@format( variable, format ) | Formats a numeric variable Examples @format(12123.4567,,.2f) => 12,123.46 @format(1.212345e6,.0f) => 1212345 |
@padLeft( variable, padchar, length ) | Adds the padchar to the LEFT of the variable until length is reached. If the original string is longer than length, then this function will have no effect Example @padLeft(Hello World,*,14) => ***Hello World |
@padRight( variable, padchar, length ) | Adds the padchar to the RIGHT of the variable until length is reached. If the original string is longer than length, then this function will have no effect. Example @padRight(Hello World,*,14) => Hello Mum*** |
@replace( variable, find, replace ) | Replaces the FIND string with the REPLACE string in the variable. Example @replace(Hello Mum,Mum,Dad) => Hello Dad |
@arrayGet( variable, index ) | Returns the entry or complex object found at location INDEX in the array specified by the variable name. If the index does not exist, the return will be a suitable error message. |
@arrayCount( variable ) | Returns the number of elements in the array specified |
@arraySet( variable, index, newitem ) | Sets the NEWITEM into the array at position INDEX. |
@arrayAdd( variable, newitem ) | Adds the NEWITEM to the end of the array supplied |
@arrayRemove( variable, index ) | Removes the INDEX item from the provided array. |
@arraySortString( variable, column, asc/desc) | Sort and return a new array, ordered by column which must be string |
@arraySortNumeric( variable, column, asc/desc) | Sort and return a new array, ordered by column which must be numeric |
@toJSON() @toJSON( baseElement ) | Takes the dictionary items as specified and creates a JSON packet based on it. See examples below for more information. |
@flatmapjson( JsonString ) | Parses a Json string into a Json object. This allows for the data within the Json object to access via dot notation. @flatmapjson("{\"customer\": {\"name\": \"Jane Smith\", \"age\": 25}}") will convert this to an object and elements can be access like so: customer.name or customer.age |
@toXML( variable, baseXMLNode ) | Converts the VARIABLE provided into a valid XML string whose base node is the name base XMLNODE. |