Tools
Engini's Functions
81 min
welcome to our functions guide! this guide is designed to help you navigate and understand the functions available in engini’s workflows so let’s get started and explore the power of functions logical functions trim function trim(\<text>, \<string of chars>?) removes all leading and trailing occurrences of a set of characters specified in second parameter (by default is white spaces) from the current string for example, trim(“%%abc”, “%”) – output will be “abc” and function and (\<expression1>, \<expression2>, …) tests whether two or more conditions are true it returns a value of true if all conditions are met, and false if one or more condition is not met for example, and (equal (x ,y), greater(x,z)) – output will be true if all conditions are met x equals to y and x greater than z, otherwise false or function or(\<expression1>, \<expression2>, …) tests whether one or more condition are true returns a value of true if at least one condition is met, and false if all conditions aren’t met for example, or (equal (x ,y), greater(x,z)) – output will be true if at least one condition is met x equals to y or x greater than z, otherwise false if function if (\<expression>, \<value if true>, \<value if false>) check whether an expression is true or false based on the result, return a specified value for example, if (equal (5 ,6),”yes”,”no”) checks if 5 equals to 6, if it is, the output will be “yes’, otherwise it will be “no” since it’s false, the output in this exmple will be “no” greater function greater(\<value>, \<compareto>) compares two values and determine whether the first value is greater than the second value the function returns a value of true if the first value is greater than the second value, and false otherwise for example, greater (12,9) checks if 12 greater than 9, if it is, the output will be true, otherwise it will be false since it’s true, the output of this function will be true greaterorequals function greaterorequals(\<value>, \<compareto>) compares two values and determine whether the first value is greater than or equal to the second value the function returns a value of true if the first value is greater than or equal to the second value, and false otherwise for example, greaterorequals (12,12) checks if 12 is greater than or equal to 12 if it is, the output will be ‘true’; otherwise, it will be ‘false ’ since in this example it’s true, the output of this function will be ‘true’ less function less(\<value>, \<compareto>) compares two values and determine whether the first value is less than the second value the function returns a value of true if the first value is less than the second value, and false otherwise for example,less (12,9) checks if 12 is less than 9, if it is, the output will be true, otherwise it will be ‘false’ since in this example it isn’t, the output of this function will be ‘false’ lessorequal function lessorequals(\<value>, \<compareto) compares two values and determine whether the first value is less than or equal to the second value the function returns a value of true if the first value is less than or equal to the second value, and false otherwise for example, lessorequals (12,12) checks if 12 is less than or equal to 12 if it is, the output will be ‘true’; otherwise, it will be ‘false ’ since in this example it is, the output of this function will be ‘true’ switch function switch(\<expression>, \<value1>, \<result1>, \[\<default>or\<value2>, \<result2>], …\[\<default>or\<value3>, \<result3>]) evaluates the expression result against a list of values and returns the result corresponding to the first matching value if there is no match, an optional default value may be returned for example, switch (level property ,1,”low”,2,”moderate”,3,”high”) checks if the level is 1, 2, or 3 and returns the corresponding result (‘low,’ ‘moderate,’ or ‘high’) not function not(\<expression>) returns true if the expression result is false, and false if the expression result is true for example, not (greater (5, 1)) checks if 5 is not greater than 1 if it’s not greater, the output will be ‘true’; otherwise, it will be ‘false ’ since in this example it’s ‘false,’ the output of this function will be ‘false ’ equal function equal(\<expression1>, \<expression2>) tests whether two values are equal to each other returns a true if the two values are equal, and false if they are not for example, equal(5, 5) checks if 5 is equal to 5 if they are equal, it returns ‘true’; otherwise, it returns ‘false ’ since in this example they are equal, the output will be ‘true’ isnull function isnull(\<expression>, \<alternateresult>?) this function serves two purposes it returns true if the expression is null, and false otherwise additionally, if an alternate result is provided, the function checks if the expression is null; if it is, the function returns the alternate result value if the expression is not null, it returns the expression value for example, isnull(engini, “123”) will check if the property engini is null if it is null, the function will return “123” if engini is not null, it will return the value of engini null function null() returns null in function i n(\<expression>, \[\<compareto1>, …, \<compareton>]) the function returns true if the first argument contained in the array of values in the second argument, and false otherwise for example, in(“john”,employees\[]) checks if ‘john’ exists in the array of employees, if he is in the array, the function returns true; otherwise, it returns false in this case, as john exists in the array of employees, the output will be ‘true’ tryparse function tryparse(\<expression>, \<defult>) if the expression is successfully parsed, it returns its calculated result otherwise, returns the supplied default value for example, tryparse(‘100’, ‘null’) attempts to parse the string ‘100’ as an integer if the parsing operation succeeds, the output of the function will be 100 however, if the parsing fails, the function returns a null value mathematical functions add function add(\<expression1>, \<expression2>) combines two or more values, or expressions numeric result and produce a sum unlike the sum function, the add function cannot accept an array for example, add (1,2) adds the value ‘1’ to the value ‘2’, so the output will be 3 sub function sub(\<minuend>, \<subtrahend>) returns the result from subtracting the values or expressions numeric results for example, sub (2,1) subtracts the value ‘1’ from the value ‘2’, so the output will be 1 divide function divide (\<numerator>, \<denominator>, \[\<alternateresult>]) returns the result from dividing arguments if the function tries to divide by 0 than it will return the alternate result for example, divide (10, 5) divides 10 by 5 and returns the value 2 multiply function multiply(\<multiplicand1>, \<multiplicand2>) returns the result of multiplying two or more values or expressions numeric results for example, multiply (8, 8) multiplies 8 by 8 and returns the value 64 power function power(\<base>,\<exponent>) raises a number to the power of a specified exponent returns the result of multiplying the base number by itself repeatedly, according to the exponent value for example, power(2, 3) multiplies 2 by itself 3 times (2 × 2 × 2) and returns 8 sum function sum(\<array1>, \[\<array2>, …]) finds the total of two or more values or expressions numeric result in an array the function can receive more than one array for example, sum(\[1,2,3] ,\[4,5,6]) sums all the elements in both arrays the output of the function will be 21 max function max(\<array1>or\<number1>, \<number2>, …) returns the largest value of a set of numbers or in a specified array for example, max (101, 55) returns the largest value, so the output will be 101 min function min(\<array1>or\<number1>, \<number2>, …) returns the smallest value of a set of numbers or in a specified array for example, min (101, 55) returns the smallest value, so the output will be 55 mod function mod(\<numerator>, \<denominator>, \[\<alternateresult>]) short for “modulus” or “modulo” returns the remainder from dividing the two values or expressions numeric results or alternate result when the denominator is zero for example, if we perform the operation mod (7, 3, 0), we get a result of 1 because 7 divided by 3 equals 2 with a remainder of 1 round function round(\<decimal>,\<number of digits>) rounds a number to the nearest integer or to a specified number of decimal places for example, round (number = 0 2333333, number of digits=3), returns the number 0 233 roundup function roundup(\<decimal>,\<number of digits>) rounds a number up to the nearest integer or a specified number of decimal places for example, if we have the number 3 14, and we want to round it up to the nearest integer (number = 0), the round up function would return 4, as it is the next highest integer value rounddown function rounddown(\<decimal>, \<number of digits>) rounds a number down to the nearest integer or a specified number of decimal places for example, if we have the number 3 99, and we want to round it down to the nearest integer (number = 0), the round down function would return 3, as it is the next lowest integer value toint function toint(\<expression>,\<default>?) converts specific expression to an integer value if the conversion was not successful returns the default value for example, if we have the expression 3 0 and we want to convert to integer, the toint function would return 3 tobool function tobool(\<expression>,\<default>?) converts specific expression to an boolean value if the conversion was not successful returns the default value for example, if we have the text “true” and we want to convert to boolean value, the tobool function would return true todecimal function todecimal(\<expression>, \<default>?) converts a specific expression to a decimal value if the conversion is not successful, it returns the default value for example, if you have the text “123 45” and want to convert it to a decimal value, the todecimal function would return 123 45 randominteger function randominteger(\<min>,\<max>) generates a random integer between the specified minimum (min) and maximum (max) values, inclusive the min value must be greater than or equal to 0, and the max value must be less than or equal to 2147483647 for example, if you provide min = 1 and max = 6, the randominteger function will return a random integer like 4 text functions concat function concat(\<text1>, \<text2>, …) combines two or more strings, or expression text results into a single string the concat function does not modify the original strings instead, it returns a new string that is the result of the concatenation for example, concat(“hello”,” world”) combines the two strings together, and the output will be ‘hello world’ replace function replace(\<text>, \<oldtext>, \<newtext>) replaces one or more occurrences of a substring in a string with a new substring the replace function does not modify the original string; it returns a new string after the replacements made the function takes three arguments the original string, the substring to be replaced, and the new substring to replace it with for example, replace (“the guide is full of examples”, “examples”, “samples”) replaces the word “examples” to “samples” in the text, so the output will be ‘the guide is full of samples’ substring function substring(\<text>, \<startindex>, \<length>?) extracts a portion of a string and return it as a subset of characters the substring function takes three arguments the text, the starting index of the substring, and the length (optional) if the length is not specified, the substring will include all characters from the starting index to the end of the string note that the index count starts at 1(not 0) for example, substring (“hello, world!”,8,5) extracts a substring from the text “hello, world!” starting at the 8th character (which is ‘w’) and including the next 5 characters the result will be “world,” slice function slice(\<text>, \<startindex>, \<endindex>?) extracts a portion of a string and return it as a new string it works similarly to the substring function, but it has some differences in the way it handles the arguments the slice function takes three arguments the text, the starting index of the slice, and the ending index of the slice (optional) if the ending index is not specified, the slice will include all characters from the starting index to the end of the string note that the index count starts at 1(not 0) for example, slice (‘hello, world!’,7,12) extracts a slice from the text “hello, world!” starting at the 7th character (which is ‘w’) and ending at the 12th character (which is ‘d’) the result will be ‘world’ tolower function tolower(\<text>) converts a string to lowercase letters and returns the new string the original string is not modified for example, tolower(“the guide is full of examples”) converts the string “the guide is full of examples ” to lowercase letters, and the result will be ” the guide is full of examples “ toupper function toupper(\<text>) converts a string to uppercase letters and returns the new string the original string is not modified for example, toupper(“the guide is full of examples”) converts the string “the guide is full of examples ” to uppercase letters, and the result will be ” the guide is full of examples “ indexof function indexof(\<text>, \<searchtext>) returns the first index of a value within a string (case insensitive) note that the index count starts at 1(not 0) for example ,indexof(“the guide is full of examples”, “guide”) searches for the first occurrence of the search text, “guide,” within the given string, “the guide is full of examples” the result will be the index of the first occurrence, which in this case is 5 nthindexof function nthindexof(\<text>, \<searchtext>, \<occurrence>) returns the index of the n th occurrence of a value within a string (case insensitive) note that the index count starts at 1(not 0) for example, nthindexof(‘saas is defined as software as a service’,’as’,2) returns 28 because it’s the index of the second occurrence of ‘as’ in the string lastindexof function lastindexof(\<text>, \<searchtext>) return the last index of a value within a string (case insensitive) note that the index count starts at 1(not 0) for example, lastindexof(“saas is defined as software as a service”, “as”) returns 29 because it’s the index of the last occurrence of “as” in the string startswith function startswith(\<text>, \<searchtext>) checks if a string starts with a value (case insensitive) returns true if the string starts with value, and false otherwise for example, startswith(“hello, world!”, “hello”) returns ‘true’ because the string “hello, world!” starts with “hello” endswith function endswith(\<text>, \<searchtext>) checks if a string ends with a value (case insensitive) returns true if the string ends with value, and false otherwise for example, endswith(“hello, world!”, “engini”) returns ‘false’ because the string “hello, world!” ends with “world” length function length(\<text>) returns the length of a given text string for example, length(“a guide”) returns the number ‘7’ because the string has 7 characters urldecode function urldecode(\<text>) returns the url decoded string of given text string for example, urldecode(‘hello%20world%21’) decodes the url encoded string “hello%20world%21” and returns ‘hello world!’ urlencode function urlencode(\<text>, \<bool>?) returns the url encoded string of given text string if second parameter is true the special symbols will be converted to uppercase for example, urlencode(‘hello world’) encodes the string ‘hello world’ into a url safe format and returns “hello+world” split function split(\<text>, \<separator>) splits a string into an array of substrings based on a specified delimiter character or substring for example, split(“avi, yuval, haim”, “,”) takes an input string ‘avi, yuval, haim’ and creates an array of strings the output will be \[ “avi”, “yuval”, “haim” ] newline function newline () returns new line character, it is used to create a new line in text, (in ascii, ‘\r\n’) for example, concat(“saas”, newline(),”saas is defined as software as a service”) as you can see, the newline function inserts a newline character, creating a line break in the resulting text the output is saas saas is defined as software as a service tostring function tostring(\<expression>,\[\<format>]) convert any expression to a string and provide an optional format string to control how the value is displayed when using the format option, you need to enclose the format string in parentheses for example, tostring(789, “d5”) converts the integer 789 to a string with 5 characters, resulting in ‘00789’ trimstart function trimstart(\<text>, \<string of chars?>) removes all leading occurrences of a specified set of characters from the current string if no set is specified, it defaults to removing whitespace for example, if you have the text “—example” and you want to remove leading hyphens, the trimstart function would return “example” trimend function trimend(text, string of chars?) removes all trailing occurrences of a specified set of characters from the current string if no set is specified, it defaults to removing whitespace for example, if you have the text "example " and you want to remove trailing hyphens, the trimend function would return "example" stringtonumber function stringtonumber(\<text>) convert a text to number for example, stringtonumber(“123”) will return the numeric value ‘123’ it converts a textual representation of a number into an actual numeric value stringtobase64 function stringtobase64(\<text>) encodes a string of text into a base64 encoded format base64 encoding is a method of converting binary data into a text format that can be transmitted over the internet for example, when you use stringtobase64(‘hello world’), it encodes the text ‘hello world’ and returns the encoded representation sgvsbg8gd29ybgq= base64tostring function base64tostring(\<text>, \[\<encoding>]) takes a base64 encoded string as input and returns the original text format encoding is optional for example, when you use base64tostring(‘sgvsbg8gd29ybgq=’), it decodes the base64 encoded text ‘sgvsbg8gd29ybgq=’ and returns the original text ‘hello world’ list of encoding options asmo 708 big5 cp1025 cp866 cp875 dos 720 dos 862 euc jp gb2312 ibm00858 ibm00924 ibm01047 ibm01140 ibm01141 ibm01142 ibm01143 ibm01144 ibm01145 ibm01146 ibm01147 ibm01148 ibm01149 ibm037 ibm1026 ibm273 ibm277 ibm278 ibm280 ibm284 ibm285 ibm290 ibm297 ibm420 ibm423 ibm424 ibm437 ibm500 ibm737 ibm775 ibm850 ibm852 ibm855 ibm857 ibm860 ibm861 ibm863 ibm864 ibm865 ibm869 ibm870 ibm871 ibm880 ibm905 ibm thai iso 8859 1 iso 8859 13 iso 8859 15 iso 8859 2 iso 8859 3 iso 8859 4 iso 8859 5 iso 8859 6 iso 8859 7 iso 8859 8 iso 8859 9 johab koi8 r koi8 u ks c 5601 1987 macintosh shift jis us ascii utf 16 utf 16be utf 32 utf 32be utf 8 windows 1250 windows 1251 windows 1252 windows 1253 windows 1254 windows 1255 windows 1256 windows 1257 windows 1258 windows 874 x chinese cns x chinese eten x cp20001 x cp20003 x cp20004 x cp20005 x cp20261 x cp20269 x cp20936 x cp20949 x ebcdic koreanextended x europa x ia5 x ia5 german x ia5 norwegian x ia5 swedish x mac arabic x mac ce x mac chinesetrad x mac croatian x mac cyrillic x mac greek x mac hebrew x mac icelandic x mac japanese x mac romanian x mac thai x mac turkish x mac ukrainian contains function contains(\<text>, \<searchtext>) checks whether a given substring (searchtext) is present in a larger string (text) this function returns a true\false value, indicating whether the substring is found in the larger string or not for example, contains (“engini is a non code platform for creating applications and business processes that interface with erp and…”,’erp’) checks if the word ‘erp’ present in the text, it returns ‘true’ since in this example ‘erp’ is indeed in the text tojsonstring function tojsonstring(\<expression>) converts a given expression into its json representation and returns it for example, tojsonstring(“example engini”) converts “example engini” to a json representation string, and the output would be “\”example engini\”” reversehebrewtext function reversehebrewtext (\<text>) the reversehebrewtext(\<text>) function reverses the characters of a given hebrew text for example, reversehebrewtext(“שלום”) will return the reversed string “םולש” this function is particularly useful when hebrew text is stored in reverse order in a database and needs to be corrected before display guid function generates a new unique identifier (uuid/guid) for example, calling the guid() function might generate a value like “123e4567 e89b 12d3 a456 426614174000” this can be useful in scenarios where a unique and non repeating identifier is required, such as creating unique keys for api resources, session identifiers, or any other case where a unique id is needed to ensure data integrity and avoid conflicts createhtmllink function createhtmllink(\<text>,\<link>) returns a reference tag for an html link parameters text – (string) the text on which you click to go to the link link – (string) the link to the webpage to go to for example, input output \<a href=”https //en wikipedia org/”>to wikipedia\</a> stringisnullorempty function stringisnullorempty function (\<expression>) checks whether a given string is empty or null this function returns a true\false value, indicating whether the string is empty\null or not for example, stringisnullorempty(“erp is defined as enterprise resource planning”) checks if the string within the function is empty or null since in this example it contains a sentence, it’s neither null nor empty, and the function will return ‘false’ linefeed function linefeed() adds a control character representing the conclusion of a line (the ascii character ‘\n’) in the following example, the use of linefeed() in concat(“first,”, linefeed(),”second”) causes ‘second’ to follow ‘first’ on the same line the expected output on a windows system would be ‘first, second’, whereas on a linux system, it would be first, second getmimetype function getmimetype (\<fileextension>) mime types serve as identifiers that specify the format of a file this function returns the mime type associated with a given file extension for example, getmimetype(‘png’) returns the mime type associated with the file extension ‘png’ the output is ‘image/png’ carriagereturn function carriagereturn() returns new line character, is used to move the cursor or insertion point to the beginning of the line (in ascii, ‘\r’) for example, the use of carriagereturn() in concat(“first,”, carriagereturn(),”second”) causes ‘second’ to follow ‘first’ on the same line, and subsequently, the carriage moves to the beginning of the line the expected output is “first, second” priorityhebconvert function priorityhebconvert(\<string>, \<columntype>) converts text to its corresponding form in the database the function expects two parameters the first is a string, and the second is the type of column in the database, which can be either char or rchar you primarily use it when the string is written in hebrew, and the type of column is char the string is written in english, and the type of column is rchar for example, priorityhebconvert(‘sara’, ‘rchar’) reverses the order of the letter in the database the ouput will be ’aras’ filelength function filelength(\<base64string>) returns the length of a file in bytes, converted from the given base64 string for example, if you have a base64 string representing a file, such as “u29tzsblegftcgxlihrlehq=”, the filelength function will return 17 0, indicating that the original file is 17 bytes in size tab function tab() returns the tab character (\t), which can be used to add horizontal spacing in text for example, if you use the tab() function to insert a tab space between words, such as tab() & "example text", it will produce "\texample text", where "\t" represents a single tab space char function char(\<int>) returns the character corresponding to the given ascii code for example, if you provide an ascii code, such as 65, the char function will return "a", which is the character represented by that ascii code ascii function ascii(\<character>) returns the ascii code of the given character for example, if you provide a character, such as "a", the ascii function will return 65, which is the ascii code for that character encryptsha1 function encryptsha1(\<text>, \<text> ? ) hashes text with sha 1 and converts to a 40 character hexadecimal string, using an optional key for added complexity for example, if you provide a text, such “hello” , the encryptsha1 function will return a hashed output like “ f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 “ encryptsha256 function encryptsha256(\<text>, \<text>?) hashes text with sha 256 and converts to a 64 character hexadecimal string, using an optional key for added complexity for example, if you provide a text, such “hello” , the encryptsha256 function will return a hashed output like “ 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969 “ encryptsha512 function encryptsha512(\<text>, \<text>?) hashes text with sha 512 and converts to a 128 character hexadecimal string, using an optional key for added complexity for example, if you provide a text, such “hello” , the encryptsha512 function will return a hashed output like “ 3615f80c9d293ed7402687f94b22d58e529b8cc7916f8fac7fddf7fbd5af4cf777d3d795a7a00a16bf7e7f3fb9561ee9baae480da9fe7a18769e71886b03f315 “ encryptmd5 function encryptmd5(\<text>, \<text>?) hashes text with md5 and converts to a 32 character hexadecimal string, using an optional key for added complexity for example, if you provide a text, such “hello” , the encryptmd5 function will return a hashed output like “ 8b1a9953c4611296a827abf8c47804d7 “ randomstring function randomstring(\<length>,\<include numbers>?) returns a random string of the specified length using uppercase (a z) and lowercase (a z) alphabetic characters optionally, it can include numbers (0 9) if the include numbers parameter is set to true by default, numbers are excluded for example, if you provide length = 5 and keep the default include numbers = false, the randomstring function might return “ phpwc “ alternatively, if you set include numbers to true, the randomstring function might return “ qt24p “ tobinary function tobinary(\<text>, \<encoding>) converts any value to binary data you can also specify encoding as a second argument to apply binary conversions from hex or base64 to binary data for example, tobinary(“hello”,) converts the string “hello” into “68656c6c6f” or tobinary(“agvsbg8=”, “base64”) converts a base64 encoded string into its original binary data, resulting in the bytes that represent the string “hello” striphtml function striphtml(\<text>) removes all html tags from text for example, striphtml(“\<p>hello \<b>world\</b>!\</p>”) returns “hello world!” date and time functions utcnow function utcnow() returns the current date and time in the utc (coordinated universal time) time zone as a string utc is a standard time zone used across the world and is often used in programming to ensure consistency across different regions for example, utcnow () will return the value ‘11/5/2023 2 01 35 pm’, which contains today’s date and the current utc time formatdatetime function formatdatetime (\<timestamp>, \<format>) returns a string in a date format for example if the current date is april 10th, 2023, using the following function formatdatetime(utcnow(),”dd/mm/yyyy”) will return 10/04/2023 localtimenow function localtimenow() return current timestamp according to timezone defined in admin page for example, localtimenow() will return the value ‘2023 11 30t12 55 23 2702804’, which contains today’s date and the current jerusalem timezone including microseconds, precisely aligned with the selected local timezone as configured within our system’s timezone settings converttolocaltime function converttolocaltime (\<timestamp>) converts given timestamp to local time according to timezone defined in admin page for example, converttolocaltime (’11/5/2023 2 01 35 pm’) is converted to the local time, resulting in the value ‘2023 11 05t16 01 35’, reflecting the current jerusalem timezone selection converttimezone function converttimezone (\<timestamp>,\<destination timezone>,\[\<source timezone>]) converts timestamp to specific timezone for example, this variable converts the current timestamp from jerusalem to the local time in russia as a result, we get ’07/24/2024 18 31 53′ in russian time notice if no source time zone is specified, the default setting is to use the time zone configured on the admin page for a list of available time zones, please refer to the timezones in functionslist guide addseconds function addseconds function (\<timestamp>, \<seconds>, \<format>?) adds an integer number of seconds to a given date and time timestamp and returns a new timestamp format is optional for example, addseconds(10 05 01,5) will add 5 seconds to the time, so the output will be 10 05 06 addminutes function addminutes function (\<timestamp>, \<minutes>, \<format>?) adds an integer number of minutes to a given date and time timestamp and returns a new timestamp format is optional for example, addminutes(10 05 01,5) will add 5 minutes to the time, so the output will be 10 10 01 addhours function addhours function (\<timestamp>, \<hours>, \<format>?) adds an integer number of hours to a given date and time timestamp and returns a new timestamp format is optional for example, addhours(10 05 01,5) will add 5 hours to the time, so the output will be 3 05 01 adddays function adddays function (\<timestamp>, \<days>, \<format>?) adds an integer number of days to a given date and time timestamp and returns a new timestamp format is optional for example, adddays(10/05/2023 ,2, “mm/dd/yyyy”) will add 5 days to the date, so the output will be 10/07/2023 addmonths function addmonths function (\<timestamp>, \<months>, \<format>?) adds an integer number of months to a given date and time timestamp and returns a new timestamp format is optional for example, addmonths(10/05/2023 ,2, “mm/dd/yyyy”) will add 2 months to the date, so the output will be 12/05/2023 addyears function addyears function (\<timestamp>, \<years>, \<format>?) adds an integer number of years to a given date and time timestamp and returns a new timestamp format is optional for example, addyears(10/05/2023 ,2, “mm/dd/yyyy”) will add 2 years to the date, so the output will be 10/05/2025 stringtodatetime function stringtodatetime (\<string>, \<format>) converts a string representation of a date and time into a timestamp the format is necessary in order for the function to identify the string correctly for example, stringtodatetime(“2023 11 02 15 30 00″,”yyyy mm dd hh\ mm\ ss”) converts the string “2023 11 02 15 30 00” into a timestamp format using the specified format “yyyy mm dd hh\ mm\ ss” the resulting timestamp will represent the date and time described in the input string the output is 11/2/2023 3 30 00 pm startofmonth function startofmonth(\<timestamp>) returns the date of the first day of the month corresponding to the input timestamp for example ,startofmonth(‘9/15/2023’) takes a particular date, which is september 15, 2023, as input and outputs the date and time set to the start of that same month, resulting in “2023 09 01 00 00” endofmonth function endofmonth(\<timestamp>) returns the date of the last day of the month corresponding to the input timestamp for example ,endofmonth(‘9/15/2023’) takes a particular date, which is september 15, 2023, as input and outputs the date and time set to the last day of that same month, resulting in “2023 09 30 00 00” dayofweek fuction dayofweek(\<timestamp>) returns the day number of the week of the timestamp the week starts from sunday(1) for example, dayof week(‘2/3/2023’) will return the value ‘6’ because the day of this timestamp is friday (day number 6 of the week) datediff function datediff (\<interval>, \<date>, \<date>) calculates the difference between two dates in various date or time units, such as years, quarters, months, weeks, days, hours, minutes, and seconds the default interval is set to a day for example, datediff(“day”,2023/09/20,2023/09/26) computes the date difference between september 20, 2023, and september 26, 2023, and return the number 6, signifying the six day gap between the two dates date function date(\<year>, \<month>, \<day>) creates a timestamp from year, month and day for example, date(2023,2,3) will return the value ‘2/3/2023 12 00 00 am’, which contains the specified date in the format ‘month/day/year’, followed by the default time ’12 00 00 am’ datetime function datetime(\<year>, \<month>, \<day>,\<hour>,\<minute>,\[\<seconds>]) creates a timestamp from date and time seconds are optional for example, date(2023,2,3,5,30) will return the value ‘2/3/2023 5 30 00 am’, which contains the specified date and time in the format ‘month/day/year hour\ minute\ seconds am/pm’ if the seconds are not provided, it defaults to ’00’ for seconds day function day(\<timestamp>) returns day of timestamp for example ,day(‘2/3/2023’) will return the value ‘3’, indicating the day component of the specified timestamp month function month(\<timestamp>) returns month of timestamp for example ,month(‘2/3/2023’) will return the value ‘2’, indicating the month component of the specified timestamp year function year(\<timestamp>) returns the year of the timestamp for example, year(‘2/3/2023’) will return the value ‘2023’, indicating the year component of the specified timestamp hour function hour(\<timestamp>) returns the hour of the timestamp for example, minutes(’11/5/2023 2 01 35 pm’) will return the value ‘2’, indicating the hour component of the specified timestamp minutes fuction minutes(\<timestamp>) returns the minutes of the timestamp for example, minutes(’11/5/2023 2 01 35 pm’) will return the value ‘1’, indicating the minutes component of the specified timestamp seconds function seconds(\<timestamp>) returns the seconds of the timestamp for example, seconds(’11/5/2023 2 01 35 pm’) will return the value ’35’, indicating the seconds component of the specified timestamp converttounixdatetime function converttounixdatetime(\<timestamp>) converts a given datetime into a unix timestamp, representing the number of seconds that have passed since midnight on january 1, 1970 (utc) for example, converttounixdatetime(<2024/12/10 15 30 00>) will return the value ‘ 1733844600 ‘, representing the number of seconds that have passed since midnight, january 1, 1970 (utc) ” workflow functions workflow function workflow() returns the details such as history id, display name, account name etc of the currently running workflow instance for example, the name of the currently executing workflow is “order update,” the workflow () function would return that name, it’s url, it’s historyid and its workflow id errors function errors (\<expression>?) returns all workflow errors that occurred in a workflow you can provide a specific step number to search errors in the output will include title, message for each error, the number of the activity, its name, and the step where the error occurred for example, when using the ‘get records’ and ‘delete record’ activities, if the ‘get records’ activity and the ‘delete record’ lack a table id or record id, the ‘errors()’ function will return the following array "title" "response status code does not indicate success 404 (not found) ", "message" "{\\"url\\" \\"tables//items\\",\\"body\\" {\\"where\\" \[],\\"isand\\"\ true,\\"top\\" 0,\\"orderby\\" \[]}}", "stepno" 7, "application" "tables", "activityname" "delete record", "title" "response status code does not indicate success 405 (method not allowed) ", "message" "{ \\"url\\" \\"/tableitems/\\", \\"data\\" }", "stepno" 7, "application" "tables", “activityname" "delete record" lasterror function lasterror () returns the last error that occurred the output will include title, message for each error, the number of the activity, its name, and the step where the error occurred for example, when using the ‘get records’ activity first and then the ‘delete record’ activity, if the ‘get records’ activity and the ‘delete record’ lack a table id or record id, there are two errors, but the ‘lasterror()’ function will return only the last error "title" "response status code does not indicate success 405 (method not allowed) ", "message" "{ \\"url\\" \\"/tableitems/\\", \\"data\\" }", "stepno" 7, "application" "tables", “activityname" "delete record" lasterrormessage function lasterrormessage() returns the error message from the last error that occurred for example, when using the ‘get records’ activity first and then the ‘delete record’ activity, if the ‘get records’ activity and the ‘delete record’ lack a table id or record id, there are two errors, but the ‘lasterrormessage()’ function will return only a message for the last error the output will be {"url" "/tableitems/", "data" } getuser function getuser() returns the current logged user details (applicable in appmaker only) for example, getuser() returns fullname daniel cohen, his email daniel c\@gmail com, his phone 0539682242, his userid “vdd8232e 6734 4aae ac8e 4905545va7” and his accountid 1222 activitystatus function activitystatus(\<step number>) reaturns the activity status 0 – not ran, 1 – ran succeefully, 2 – ran with error, 3 – waiting for example, activitystatus(3) will return a value of ‘1’ if activity number 3 in the workflow has run successfully workflowlastrundate function workflowlastrundate() returns the timestamp of the last run of the workflow getworkflowhistoryid function getworkflowhistoryid() returns the workflow history id of the currently running workflow instance for example, if a workflow is currently executing and has a history id of 12345, calling the getworkflowhistoryid() function would return 12345 collection functions createarray function createarray (\<array> or \<expression 1>, \<expression 2>, …) returns an array with the provided values or expression results for example, createarray(“friday”,”saturday”,”sunday”) creates an array that contains 3 days of the week “friday” “saturday” “sunday” arraylength function arraylength (\<array>) returns the length (number of objects / values) in the provided array for example, arraylength(\[1,2,3,4]) returns the length 4 if the array is empty, the output will be 0, because there are no objects/ values in the array first function first (\<array>) returns the first element of an array for example, first (\[“friday”,”saturday”,”sunday”]) returns the first element in an array in this case, it returns the first day within the array, which is “friday” last function last (\<array>) returns the last element of an array for example, last (\[“friday”,”saturday”,”sunday”]) returns the last element in an array in this case, it returns the last day within the array, which is “sunday” join function join (\<separator>, \<array>) concatenates all the items of an array into a string, using a specified separator between each item for example, join(“\”,'\[“friday”, “saturday”, “sunday”]’) combines the days into a single string using a “\” as a separator this function will create a string that looks like this friday\saturday\sunday getarrayelement function getarrayelement (\<array>, \<expression>) returns value from the provided array by the provided index or expression numeric result note that the index count starts at 0 (not 1) or example, getarrayelement(\[“friday”, “saturday”, “sunday”] ,2) returns sunday getproperty function getproperty (\<object>, \<expression>) returns value from the provided object by the provided property or expression text result for example, getproperty(person,”name”) returns the name of the person from the object person in this case, it will return ‘yuval’ distinct function distinct (\<array>) returns an array without duplicates for example, distinct(\[“a”, “b”, “a”]) returns \[“a”, “b”]