{"id":2728,"date":"2017-07-28T07:00:02","date_gmt":"2017-07-28T11:00:02","guid":{"rendered":"https:\/\/wiki.wehoop.com\/?post_type=ht_kb&#038;p=2728"},"modified":"2021-06-21T13:55:16","modified_gmt":"2021-06-21T17:55:16","slug":"introduction-to-the-formulas-language","status":"publish","type":"ht_kb","link":"https:\/\/wiki.wehoop.com\/en\/article\/introduction-to-the-formulas-language","title":{"rendered":"Introduction to the formulas language"},"content":{"rendered":"<p>WEHOOP uses the Formula Language to perform operations, calculations and comparisons in a form that remains simple. The Formula Language is very similar to the language used by Microsoft Excel.<\/p>\n<p>See also the <a href=\"https:\/\/wiki.wehoop.com\/en\/article\/introduction-to-the-hoop-language\">@hoop language<\/a>.<\/p>\n<p>The Formula Language consists of functions and operators. There are three (3) major categories of functions: arithmetic, text and dates-times.<\/p>\n<h2>Working with operators<\/h2>\n<p>Operators are used to compare or assimilate values and for mathematical calculations. The following table lists the main operators used in the formulas.<\/p>\n<table border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody style=\"vertical-align: top;\">\n<tr>\n<td style=\"color: #ffffff; background: #41b6e6;\" width=\"25%\">OPERATORS<\/td>\n<td style=\"color: #ffffff; background: #41b6e6;\" align=\"center\" width=\"75%\">DESCRIPTION<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">&#8211;<\/td>\n<td width=\"75%\">Used in subtraction or to represent a negative number<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">+<\/td>\n<td width=\"75%\">Used in addition or to represent a positive number<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">*<\/td>\n<td width=\"75%\">Used in multiplication<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">\/<\/td>\n<td width=\"75%\">Used in division<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">!<\/td>\n<td width=\"75%\">Represents a logical NOT<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">&amp;<\/td>\n<td width=\"75%\">Represents a logical AND<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">|<\/td>\n<td width=\"75%\">Represents a logical OR<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">:<\/td>\n<td width=\"75%\">Used to separate a list of values<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">:=<\/td>\n<td width=\"75%\">Used to assign a value to a variable<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">!=<\/td>\n<td width=\"75%\">Represents not equal<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">&lt;<\/td>\n<td width=\"75%\">Represents less than<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">&lt;=<\/td>\n<td width=\"75%\">Represents less or equal to<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">&lt;&gt;<\/td>\n<td width=\"75%\">Represents not equal<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">=<\/td>\n<td width=\"75%\">Represents equal<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">&gt;<\/td>\n<td width=\"75%\">Represents greater than<\/td>\n<\/tr>\n<tr>\n<td width=\"25%\"align=\"center\">&gt;=<\/td>\n<td width=\"75%\">Represents greater than or equal to<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Evaluate a condition<\/h2>\n<p>This simple function is very useful for WEHOOP. It offers the possibility of comparing values and performing operations under certain conditions.<\/p>\n<p>It is mainly used to indicate in which cases a field is mandatory or in the case of a conditional transition at the workflow level.<br \/>\n<strong>Usage<\/strong><\/p>\n<ul>\n<li>Subject of the form<\/li>\n<li>Mandatory based on condition<\/li>\n<li>Hide on condition<\/li>\n<li>Initial value<\/li>\n<li>Minimal value<\/li>\n<li>Maximal value<\/li>\n<li>Validation formula<\/li>\n<\/ul>\n<h3>@If<\/h3>\n<p>Evaluates a condition; if the condition is True, WEHOOP performs the action appearing immediately after that condition, and stops. If the condition is False, WEHOOP skips to the next condition and tests it, and so on. If none of the conditions is True, WEHOOP performs the else_action.<br \/>\n<strong>Syntax<\/strong><br \/>\n@If( condition1 ; action1 ; condition2 ; action2 ; &#8230; ; condition99 ; action99 ; else_action )<br \/>\n<strong>Parameters<\/strong><br \/>\ncondition<br \/>\nExpression that returns a Boolean. If this expression returns True, action is performed. If it&#8217;s False, WEHOOP skips to the next condition, if there is one. Otherwise, WEHOOP performs else_action.<br \/>\naction<br \/>\nAn action to be performed or a value to be returned if the governing condition returns True.<br \/>\nelse_action<br \/>\nAn action to be performed or a value to be returned if none of the conditions returns True.<br \/>\n<strong>Usage<\/strong><br \/>\nIn its simplest form, the If statement looks like this: @If( condition ; action ; else_action ).<br \/>\nYou can list up to 99 conditions and corresponding actions, followed by just one action to be performed when all the conditions are False. As soon as a condition evaluates to True, WEHOOP performs the associated action and ignores the remainder of the @If statement.<br \/>\nWEHOOP accepts the form @If( condition ), with only one condition and no action, but does not perform any action based on the condition.<\/p>\n<p>If you compare a field to a value (for example, Year &gt; 1995) and the field is unavailable, the comparison is False. However, you should check for fields that may not be present with @IsUnavailable.<br \/>\n<strong>Examples<\/strong><br \/>\nThis formula tests the single value in the CostOfGoods field. If the value is greater than or equal to 12.45, the condition is True, and the string &quot;Over Budget&quot; is returned. If the value is less than 12.45, the condition is False and the string &quot;Bill of Materials OK&quot; is returned.<br \/>\n@If(CostOfGoods&gt;=12.45;&quot;Over Budget&quot;;&quot;Bill of Materials OK&quot;) <\/p>\n<p>In this example, if CostOfGoods is less than 12.45, the null string is returned.<br \/>\n@If(CostOfGoods&gt;=12.45;&quot;Over Budget&quot;;&quot;&quot;)<\/p>\n<h2>Performing arithmetic operations<\/h2>\n<p>The * \/ + &#8211; operators multiply, divide, add, and subtract. Multiplication and division have precedence over addition and subtraction; otherwise, evaluation is left to right. Parentheses can be used to change the order of evaluation. The following are the arithmetic @functions.<\/p>\n<h3>@IsNumber<\/h3>\n<p>Indique si une valeur donn\u00e9e est un nombre (ou une liste de nombres).<br \/>\n<strong>Syntaxe<\/strong><br \/>\n@IsNumber( valeur )<br \/>\n<strong>Parameters<\/strong><br \/>\nvaleur : Any data type. Any value.<br \/>\n<strong>Return value<\/strong><br \/>\nReturns 1 (True) if the value is a number or a number list<br \/>\nReturns 0 (False) if the value is not a number or a number list<br \/>\n<strong>Usage<\/strong><br \/>\nThis is a useful function for checking to see that you have assigned field data types correctly.<br \/>\nThe parameter must be a number, not a non-numeric value (for example, text) that can be converted to a number.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 1.<br \/>\n@IsNumber(123)<\/p>\n<p>This example returns 0.<br \/>\n@IsNumber(&quot;123&quot;)<\/p>\n<h3>@Modulo<\/h3>\n<p>Returns the remainder of a division operation.<br \/>\n<strong>Syntaxe<\/strong><br \/>\n@Modulo( number1 ; number2 )<br \/>\n<strong>Parameters<\/strong><br \/>\nnumber1<br \/>\nNumber or number list.<br \/>\nnumber2<br \/>\nNumber or number list. If this is equal to 0, @Modulo returns @ERROR.<br \/>\n<strong>Return value<\/strong><br \/>\nremainder<br \/>\nNumber or number list. The remainder of number1 divided by number2. If the parameters are number lists, @Modulo returns a list that is the result of pair-wise computation on the list values. The sign of the result is always the same as the sign of the number1.<br \/>\n<strong>Usage<\/strong><br \/>\nA common use of @Modulo is to determine whether a number is odd or even; if the result of @Modulo(number;2) is 1, the number is odd; if the result is 0, the number is even.<br \/>\nWhen using this function with a number list, the list concatenation operator takes precedence over any other operators; negative numbers must be enclosed in parentheses.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 1.<br \/>\n@Modulo(4;3)<\/p>\n<p>This example returns 0.<br \/>\n@Modulo(4;2)<\/p>\n<h3>@Text<\/h3>\n<p>Converts any value to a text string.<br \/>\n<strong>Syntaxe<\/strong><br \/>\n@Text( value ; format-string )<br \/>\n<strong>Parameters<\/strong><br \/>\nvalue<br \/>\nNumber, time-date, text, list thereof, or rich text. The value you want to convert to text.<\/p>\n<p>format-string<br \/>\nText or text list. Optional. Up to four format-strings (see table that follows). These determine how the text is returned. If the value is already a text data type, the format-string is ignored.<br \/>\n<strong>Return value<\/strong><br \/>\ntextValue<br \/>\nText or text list. The value you specified, converted to text. If you used any format-strings, they are applied.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<\/p>\n<p>Once a number value is converted to text, you will not be able to use the number for arithmetic calculations.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 123.45.<br \/>\n@Text(123.45)<\/p>\n<h3>@Sum<\/h3>\n<p>Adds a set of numbers or number lists.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Sum( numbers )<br \/>\n<strong>Parameters<\/strong><br \/>\nnumbers<br \/>\nNumbers or number lists. As many numbers or number lists as you want to sum.<br \/>\n<strong>Return value<\/strong><br \/>\nresult<br \/>\nNumber. The sum of all the numbers, including members of number lists.<br \/>\n<strong>Usage<\/strong><br \/>\nMake sure the fields you send as parameters contain a number value &#8212; WEHOOP interprets empty number fields as the null string.<br \/>\nSince list concatenation has the highest precedence, list elements that are expressions must be in parentheses if the expression applies only to that element. For example, write @Sum(1:2:(-3):4), not @Sum(1:2:-3:4), if 3 is negative and 4 is not.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 3.<br \/>\n@Sum( 1 : 2 )<\/p>\n<p>This example returns 11.<br \/>\n@Sum( (-1) : 2 ; (-10) : 20 )<\/p>\n<h3>@TextToNumber<\/h3>\n<p>Converts a text string to a number, where possible.<br \/>\n<strong>Syntax<\/strong><br \/>\n@TextToNumber( string )<br \/>\n<strong>Parameters<\/strong><br \/>\nstring<br \/>\nText or text list. The string you want to convert to a number. If the string contains both numbers and letters, it must begin with a number to be converted properly. For example, the string &quot;12ABC&quot; converts to 12, but &quot;ABC12&quot; produces an error.<br \/>\n<strong>Return value<\/strong><br \/>\nnumber<br \/>\nNumber or number list. The string, converted to a number.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\nThis function is useful for converting a number in a text field to a number that can be used for computation in a number field.<\/p>\n<p>You can&#8217;t use @TextToNumber to convert special text (such as that returned by @DocChildren or @DocDescendants) to a number.<br \/>\n@TextToNumber returns an error If you try to pass anything besides a string into it.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 123 as a number.<br \/>\n@TextToNumber(&quot;123&quot;)<\/p>\n<p>This example returns 123 and 456 as a number list.<br \/>\n@TextToNumber(&quot;123&quot; : &quot;456&quot;)<\/p>\n<h2>Performing string operations<\/h2>\n<p>Formula language @functions enable you to:<br \/>\n\u2022 Convert data types<br \/>\n\u2022 Concatenate, compare, and determine length<br \/>\n\u2022 Locate and extract substrings<br \/>\n\u2022 Trim, repeat, add a new line, and change case<\/p>\n<h3>@Contains<\/h3>\n<p>Determines whether a substring is stored within a string.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Contains( string ; substring )<br \/>\n<strong>Parameters<\/strong><br \/>\nstring<br \/>\nText or text list. The string(s) you want to search.<br \/>\nsubstring<br \/>\nText or text list. The string(s) you want to search for in string.<br \/>\n<strong>Return value<\/strong><br \/>\nReturns true (1) if any substring is contained in one of the strings<br \/>\nReturns false (0) if no substrings are contained in any of the strings<br \/>\n<strong>Usage<\/strong><br \/>\nThis function is case-sensitive.<br \/>\nIf either parameter is a list, the function returns 1 if any element of parameter 1 contains any element of parameter 2.<\/p>\n<p>You cannot use this function to test for substrings in a rich text field.<br \/>\nAvoid using this function to test for an exact match (that is, parameter 2 equals parameter 1). The result will be wrong if parameter 1 is not an exact match but does contain parameter 2. Use the equal operator or @IsMember, which will give the desired result and are more efficient.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 1 to indicate that the substring, &quot;Th,&quot; is contained in the string, &quot;Hi There.&quot;<br \/>\n@Contains(&quot;Hi There&quot;;&quot;Th&quot;)<\/p>\n<p>This example returns 1 to indicate that the items in one text list are contained in the other text list.<br \/>\n@Contains(&quot;Tom&quot;:&quot;Dick&quot;:&quot;Harry&quot;;&quot;Harry&quot;:&quot;Tom&quot;)<\/p>\n<h3>@Elements<\/h3>\n<p>Calculates the number of text, number, or time-date values in a list. This function always returns a number to indicate the number of entries in the list.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Elements( list )<\/p>\n<p>Parameters<br \/>\nlist<br \/>\nText list, number list, or time-date list.<br \/>\n<strong>Return value<\/strong><br \/>\nnumElements<br \/>\nNumber. The number of elements in the list. If the field value is a null string, @Elements(list) returns the number 0. @Count returns 1 if the field value is a null string or not a list value.<br \/>\n<strong>Usage<\/strong><br \/>\nYou can use @Elements in the condition statement of @For functions to set the loop count equal to the number of elements in the list:<br \/>\n@For(n := 1; n &lt;= @Elements(list); n := n + 1;formula)<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 4 if the list in the SalesForce field is &quot;Rogers&quot;:&quot;Binney&quot;:&quot;Harris&quot;:&quot;Larson.&quot;<br \/>\n@Elements(SalesForce)<\/p>\n<p>This example returns 2.<br \/>\n@Elements(&quot;Jones&quot;:&quot;Portsmore&quot;)<\/p>\n<h3>@IsMember<\/h3>\n<p>Indicates if a piece of text (or a text list) is contained within another text list. The function is case-sensitive.<br \/>\n<strong>Syntax<\/strong><br \/>\n@IsMember( textValue ; textListValue ) @IsMember( textListValue1 ; textListValue2 )<br \/>\n<strong>Parameters<\/strong><br \/>\ntextValue<br \/>\nText.<br \/>\ntextListValue<br \/>\nText list.<br \/>\ntextListValue1<br \/>\nText list.<br \/>\ntextListValue2<br \/>\nText list.<br \/>\n<strong>Return value<\/strong><br \/>\nReturns 1 (True) if the textValue is contained in textListValue<br \/>\nReturns 0 (False) if not<br \/>\nIf both parameters are lists, returns 1 if all elements of textListValue1 are contained in textListValue2<br \/>\n<strong>Usage<\/strong><br \/>\nIn processing lists, @IsMember differs from a simple = test. An = returns True if the pair-wise comparison of two entities has even one member; that is, it is not empty.<br \/>\nFor further details on pair-wise operators, see the topic Operations on lists.<br \/>\n@IsMember returns True only if the first parameter is an exact match, or a subset of the second parameter which is a list.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 1.<br \/>\n@IsMember(&quot;computer&quot;;&quot;printer&quot;:&quot;computer&quot;:&quot;monitor&quot;)<\/p>\n<p>This example returns 0.<br \/>\n@IsMember(&quot;computer&quot;:&quot;Notes&quot;;&quot;Notes&quot;:&quot;printer&quot;:&quot;monitor&quot;)<\/p>\n<h3>@Left<\/h3>\n<p>Searches a string from left to right and returns the leftmost characters of the string.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Left( stringToSearch ; numberOfChars ) @Left( stringToSearch ; subString )<br \/>\n<strong>Parameters<\/strong><br \/>\nstringToSearch<br \/>\nText or text list. The string where you want to find the leftmost characters.<br \/>\nnumberOfChars<br \/>\nNumber. The number of characters to return. If the number is 2, the first two characters of the string are returned; if the number is 5, the first five characters are returned, and so on. If the number is negative, the entire string is returned.<br \/>\nsubString<br \/>\nText. A substring of stringToSearch. @Left returns the characters to the left of subString. It finds subString by searching stringToSearch from left to right.<br \/>\n<strong>Return value<\/strong><br \/>\nresultString<br \/>\nText or text list. The leftmost characters in stringToSearch. The number of characters returned is determined by either numberOfChars or subString. @Left returns &quot;&quot; if subString is not found in stringToSearch.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the first parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns Len.<br \/>\n@Left(&quot;Lennard Wallace&quot;;3)<\/p>\n<p>This example returns Lennard Wal if the string in the Contact field is Lennard Wallace.<br \/>\n@Left(Contact;&quot;la&quot;)<\/p>\n<h3>@LowerCase<\/h3>\n<p>@LowerCase (Formula Language)<br \/>\nConverts the uppercase letters in the specified string to lowercase.<br \/>\n<strong>Syntax<\/strong><br \/>\n@LowerCase( string )<br \/>\nParameters<br \/>\nstring<br \/>\nText or text list. The string you want to convert to lowercase.<br \/>\n<strong>Return value<\/strong><br \/>\nlowerCaseString<br \/>\nText or text list. The string, converted to lowercase letters.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<\/p>\n<p>This function is useful when you want to search for a particular value and cannot predict whether it appears in lowercase or uppercase letters, or a combination of the two. You can also use it as an input translation formula to convert the contents of a field to lowercase.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns juan mendoza.<br \/>\n@LowerCase(&quot;Juan Mendoza&quot;)<\/p>\n<p>This example returns arm chair if the Furniture field contains &quot;Arm Chair,&quot; &quot;Arm chair,&quot; &quot;arm chair,&quot; or &quot;ARM CHAIR,&quot; or any other variation.<br \/>\n@LowerCase(Furniture)<\/p>\n<h3>@Middle<\/h3>\n<p>Returns any substring from the middle of a string. The middle is found by scanning the string from left to right, and parameters determine where the middle begins and ends.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Middle( string ; offset ; numberchars ) @Middle( string ; offset ; endstring ) @Middle( string ; startString ; endstring ) @Middle( string ; startString ; numberchars )<br \/>\n<strong>Parameters<\/strong><br \/>\nstring<br \/>\nText or text list. Any string.<br \/>\noffset<br \/>\nNumber. A character position in string that indicates where you want the middle to begin, always counting from left to right. The middle begins one character after the offset.<br \/>\nstartString<br \/>\nText. A substring of string that indicates where you want the middle to begin, always counting from left to right. The middle begins one character after the end of startString.<br \/>\nnumberchars<br \/>\nNumber. The number of characters that you want in the middle. If numberchars is negative, the middle starts at offset or startString and continues from right to left. If numberchars is positive, the middle starts one character past the offset or startString and continues from left to right.<br \/>\nendstring<br \/>\nText. A substring of string that indicates the end of the middle. @Middle returns all the characters between offset and endstring, or between startString and endstring.<br \/>\n<strong>Return value<\/strong><br \/>\nmiddle<br \/>\nText or text list. The substring from the middle of string, which begins at the offset or startString you specify and ends at the endstring you specify, or after the numberchars have been reached.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the first parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns h C. The offset is positioned at the &quot;t&quot; (the fourth character from the left), and the count starts with the first character after the offset, moving from left to right.<br \/>\n@Middle(&quot;North Carolina&quot;;4;3)<\/p>\n<p>This example returns ort. The offset is positioned at the &quot;t&quot; (the fourth character from the left), and the count begins at the offset, moving from right to left.<br \/>\n@Middle(&quot;North Carolina&quot;;4;-3)<\/p>\n<h3>@Name<\/h3>\n<h3>@Right<\/h3>\n<p>Returns the rightmost characters in the string. You can specify the number of rightmost characters you want returned, or you can indicate that you want all the characters following a specific substring.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Right( stringToSearch ; numberOfChars ) or @Right( stringToSearch ; subString )<br \/>\n<strong>Parameters<\/strong><br \/>\nstringToSearch<br \/>\nText or text list. The string whose rightmost characters you want to find.<br \/>\nnumberOfChars<br \/>\nNumber. The number of characters to return. If the number is 2, the last two characters of stringToSearch are returned; if the number is 5, the last five characters are returned, and so on.<br \/>\nsubString<br \/>\nText. A substring of stringToSearch. @Right returns all of the characters to the right of subString. It finds subString by searching stringToSearch from left to right.<br \/>\n<strong>Return value<\/strong><br \/>\nresultString<br \/>\nText or text list. The rightmost characters in stringToSearch. The number of characters returned is determined by either numberOfChars or subString. @Right returns &quot;&quot; if subString is not found in stringToSearch.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the first parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns &quot;ace,&quot; the rightmost 3 characters in the string.<br \/>\n@Right(&quot;Lennard Wallace&quot;;3)<\/p>\n<p>This example returns &quot;Wallace,&quot; which represents everything to the right of the first occurrence of the blank space.<br \/>\n@Right(&quot;Lennard Wallace&quot;;&quot; &quot;)<\/p>\n<h3>@Sort<\/h3>\n<p>Sorts a list.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Sort( list ; [ order ])<br \/>\n<strong>Parameters<\/strong><br \/>\nlist<br \/>\nText, number, or time-date list. The values to be sorted. Any alternate data types are returned unchanged.<br \/>\n[ order ]<br \/>\nKeyword. Optional. You can use the following keywords to specify the order of the sort:<br \/>\n[ASCENDING]<br \/>\n[DESCENDING]<br \/>\n<strong>Return value<\/strong><br \/>\nlist<br \/>\nText, number, or time-date list. The sorted values.<br \/>\n<strong>Usage<\/strong><br \/>\nThe ascending, case-, and accent-sensitive sort sequence for the English character set is as follows: the numbers 0-9, the alphabetic characters aA-zZ, the apostrophe, the dash, and the remaining special characters. Pitch-sensitivity affects double-byte languages.<br \/>\n<strong>Examples<\/strong><br \/>\nThis formula returns: Albany, New Boston, new york, San Francisco.<br \/>\n@Sort(@ThisValue)<br \/>\nSame as preceding.<br \/>\n@Sort(@ThisValue; [ASCENDING])<\/p>\n<p>This formula returns: San Francisco, New Boston, new york, and Albany.<br \/>\n@Sort(@ThisValue; [DESCENDING])<\/p>\n<h3>@Subset<\/h3>\n<p>Searches a list from beginning to end and returns the number values you specify. If you specify a negative number, @Subset searches the list from beginning to end, but the result is ordered as from the beginning of the list.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Subset( list ; number )<br \/>\n<strong>Parameters<\/strong><br \/>\nlist<br \/>\nText list, number list, time-date list, or time-date range list. The list whose subset you want.<br \/>\nnumber<br \/>\nNumber. The number of values from list that you want. Specifying zero (0) returns the error, &quot;The second argument to @Subset must not be zero.&quot;<br \/>\n<strong>Return value<\/strong><br \/>\nsubsetList<br \/>\nText list, number list, or time-date list.The list, containing the number of values you specified.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns New Orleans;London.<br \/>\n@Subset(&quot;New Orleans&quot;:&quot;London&quot;:&quot;Frankfurt&quot;:&quot;Tokyo&quot;;2)<\/p>\n<p>This example returns London;Frankfurt;Tokyo.<br \/>\n@Subset(&quot;New Orleans&quot;:&quot;London&quot;:&quot;Frankfurt&quot;:&quot;Tokyo&quot;;-3)<\/p>\n<h2>Performing time-date operations<\/h2>\n<p>A time-date value consists of a year, month, day, hour, minute, and second. You can use a time-date value &quot;as is&quot; in a time-date field, but must convert it with @Text to use it as a string. You can convert a string to a time-date value with @TextToTime.<\/p>\n<h3>@Adjust<\/h3>\n<p>Adjusts the specified time-date value by the number of years, months, days, hours, minutes, and\/or seconds you specify. The amount of adjustment may be positive or negative.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Adjust( dateToAdjust ; years ; months ; days ; hours ; minutes ; seconds ; [DST] )<br \/>\n<strong>Parameters<\/strong><br \/>\ndateToAdjust<br \/>\nTime-date or time-date list. The time-date value you want to increment. This should be a single date, not a range.<br \/>\nyears<br \/>\nNumber. The number of years to increment by.<br \/>\nmonths<br \/>\nNumber. The number of months to increment by.<br \/>\ndays<br \/>\nNumber. The number of days to increment by.<br \/>\nhours<br \/>\nNumber. The number of hours to increment by.<br \/>\nminutes<br \/>\nNumber. The number of minutes to increment by.<br \/>\nseconds<br \/>\nNumber. The number of seconds to increment by.<br \/>\n[DST]<br \/>\nKeyword. Optional. Specify [INLOCALTIME] to further adjust the time for daylight-saving time if the adjustment crosses the boundary and daylight-saving time is in effect. Specify [INGMT] or omit this parameter to not further adjust the time for daylight-saving time. The adjustment is such that adding or subtracting in day increments yields the same time in the new day.<br \/>\n<strong>Return value<\/strong><br \/>\nadjustedDate<br \/>\nTime-date. The date, incremented by the amount of time you have specified.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the first parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\nYou must include all arguments except the [DST] keyword; include a zero (0) for parameters you don&#8217;t want to adjust.<br \/>\nThe arguments are applied from right to left. For instance, @Adjust([2\/2\/2006]; 0; 2; 28; 0; 0; 0) returns [5\/2\/2006], not [4\/30\/2006] as you might expect. This is because @Adjust first adds 28 days, making [3\/2\/2006], then adds two months, making [5\/2\/2006]. To first add two months, then add 28 days, use @Adjust twice, for instance: @Adjust(@Adjust([02\/02\/2006]; 0; 2; 0; 0; 0; 0); 0; 0; 28; 0; 0; 0)<br \/>\n<strong>Tip<\/strong><br \/>\nTo find the difference between two dates, subtract them. The result is returned in seconds. To adjust the result to days, divide the result by 86,400 &#8211; which is the number of seconds in a day.<\/p>\n<p>For example: (date2-date1)\/86400<br \/>\nThis code returns 4.<br \/>\n<strong>Calculating due dates<\/strong><br \/>\nA typical use for @Adjust is calculating a due date from an entry date, by adjusting only one component of the time-date value, for example, the month component.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 03\/20\/94. A date that is 2 years and 10 days before the supplied date.<br \/>\n@Adjust([03\/30\/96];-2;0;-10;0;0;0)<\/p>\n<p>This example returns 09\/1\/97 and 09\/2\/97.<br \/>\n@Adjust([06\/29\/95] : [06\/30\/95]; 2; 2; 2; 0; 0; 0)<\/p>\n<p>This example returns the date one month from the date in the field named Date.<br \/>\n@Adjust(Date;0;1;0;0;0;0) <\/p>\n<p>This example returns the date one month and one day from the current time-date.<br \/>\n@Adjust(@Now;0;1;1;0;0;0)<br \/>\nGiven a date, this formula calculates the beginning of the week. It takes the date stored in the dueDate field, and returns the date representing the previous Monday. For example, if dueDate is 06\/02\/95, this formula returns 05\/29\/95.<br \/>\n@Adjust( dueDate; 0; 0; &#8211; ( @Weekday( dueDate ) &#8211; 2 ); 0; 0; 0 )<br \/>\n@Adjust(@Adjust([02\/02\/2006]; 0; 2; 0; 0; 0; 0); 0; 0; 28; 0; 0; 0)<\/p>\n<h3>@Date<\/h3>\n<p>Translates numbers for the various components of time and date, then returns the time-date value.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Date( year ; month ; day ) @Date( year ; month ; day ; hour ; minute ; second ) @Date( time-date )<br \/>\n<strong>Parameters<\/strong><br \/>\nyear<br \/>\nNumber. The year that you want to appear in the resulting date. You must specify an entire four-digit year. (For example, use 1996, not 96).<br \/>\nmonth<br \/>\nNumber. The month that you want to appear in the resulting date. (For example, use 1 to specify January).<br \/>\nday<br \/>\nNumber. The day that you want to appear in the resulting date.<br \/>\nhour<br \/>\nNumber. The number of hours. This value will be truncated from the resulting date.<br \/>\nminute<br \/>\nNumber. The number of minutes. This value will be truncated from the resulting date.<br \/>\nsecond<br \/>\nNumber. The number of seconds. This value will be truncated from the resulting date.<br \/>\ntime-date<br \/>\nTime-date or time-date list. For a time-date value such as @Now or [10\/31\/93 12:00:00], @Date removes the time portion of the value, leaving only the date.<br \/>\n<strong>Return value<\/strong><br \/>\ntruncatedTimeDate<br \/>\nTime-date. The date corresponding to the parameters that you sent to @Date, minus any time components.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the parameter is a date-time list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\nSpecifying invalid numbers will result in a blank date.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 06\/23\/95.<br \/>\n@Date(1995; 06; 23)<br \/>\nThis example returns 06\/23\/0095.<br \/>\n@Date(95; 06; 23)<br \/>\nThis example returns 06\/23\/2095.<br \/>\n@Date(2095; 06; 23)<\/p>\n<h3>@Day<\/h3>\n<p>Extracts the day of the month from the specified date.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Day( timeDateValue )<br \/>\n<strong>Parameters<\/strong><br \/>\ntimeDateValue<br \/>\nTime-date or time-date list. The date containing the day value that you want to extract.<br \/>\n<strong>Return value<\/strong><br \/>\ndayOfMonth<br \/>\nNumber or number list. The number corresponding to the day of the month indicated by timeDateValue. Returns -1 if the time-date provided contains only a time value and not a date.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 15 if today is July 15, August 15, September 15, and so on.<br \/>\n@Day(@Now)<br \/>\nThis example returns 20 and 21 in a list.<br \/>\n@Day([11\/20\/95 8:58:12] : [11\/21\/95 8:58:12])<br \/>\nThis example returns the string &quot;Payment received on or before the 15th&quot; if the PaymentReceived field is filled in on or before the 15th of the month; otherwise, it returns the string &quot;Payment received after the 15th.&quot;<br \/>\n@If(@Day(PaymentReceived)&lt;16;&quot;Payment received on or before the 15th&quot;;&quot;Payment received after the 15th&quot;)<\/p>\n<h3>@Month<\/h3>\n<p>Extracts the number of the month from the specified time-date.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Month( time-date )<br \/>\n<strong>Parameters<\/strong><br \/>\ntime-date<br \/>\nTime-date or time-date list. The value with the month that you want to extract.<br \/>\n<strong>Return value<\/strong><br \/>\nmonth<br \/>\nNumber or number list. The number of the month. Returns -1 if the time-date provided contains only a time value and not a date.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 1.<br \/>\n@Month([1\/15\/88])<br \/>\nThis example returns 1 and 2 in a list.<br \/>\n@Month([1\/15\/88] : [2\/15\/88])<br \/>\nThis example returns 12 if it is December.<br \/>\n@Month(@Now)<\/p>\n<h3>@Text<\/h3>\n<p>Converts any value to a text string.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Text( value ; format-string )<br \/>\n<strong>Parameters<\/strong><br \/>\nvalue<br \/>\nNumber, time-date, text, list thereof, or rich text. The value you want to convert to text.<br \/>\nNote<br \/>\nConversion of rich text is new with Release 6.<br \/>\nformat-string<br \/>\nText or text list. Optional. Up to four format-strings (see table that follows). These determine how the text is returned. If the value is already a text data type, the format-string is ignored.<br \/>\nReturn value<br \/>\ntextValue<br \/>\nText or text list. The value you specified, converted to text. If you used any format-strings, they are applied.<br \/>\n@Text with time-date components<br \/>\nThere are four separate categories of time-date, format-string components. You can include up to four components, but only one from each category.<\/p>\n<table width=\"100%\">\n<tbody>\n<tr>\n<th>Symbol<\/th>\n<th>Meaning<\/th>\n<\/tr>\n<tr>\n<td>D0<\/td>\n<td>Month, day and year<\/td>\n<\/tr>\n<tr>\n<td>D1<\/td>\n<td>Month and day, year if it is not the current year<\/td>\n<\/tr>\n<tr>\n<td>D2<\/td>\n<td>Month and day<\/td>\n<\/tr>\n<tr>\n<td>D3<\/td>\n<td>Month and year<\/td>\n<\/tr>\n<tr>\n<td>T0<\/td>\n<td>Hour, minute, and second<\/td>\n<\/tr>\n<tr>\n<td>T1<\/td>\n<td>Hour and minute<\/td>\n<\/tr>\n<tr>\n<td>Z0<\/td>\n<td>Always convert time to this zone<\/td>\n<\/tr>\n<tr>\n<td>Z1<\/td>\n<td>Display zone only when it is not this zone<\/td>\n<\/tr>\n<tr>\n<td>Z2<\/td>\n<td>Display zone always<\/td>\n<\/tr>\n<tr>\n<td>S0<\/td>\n<td>Date only<\/td>\n<\/tr>\n<tr>\n<td>S1<\/td>\n<td>Time only<\/td>\n<\/tr>\n<tr>\n<td>S2<\/td>\n<td>Date and time<\/td>\n<\/tr>\n<tr>\n<td>S3<\/td>\n<td>Date, time, Today, or Yesterday<\/td>\n<\/tr>\n<tr>\n<td>Sx<\/td>\n<td>Use when you cannot predict the exact format of the value being passed, but you know that it is either a time, a date, or both.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>@Text with number values<br \/>\nFor number values, compose a format-string by combining any of the following components into a string.<br \/>\nSymbol<br \/>\nMeaning<br \/>\nG<br \/>\nGeneral format (significant digits only)<br \/>\nF<br \/>\nFixed format (set number of decimal places)<br \/>\nS<br \/>\nScientific format (E notation)<br \/>\nC<br \/>\nCurrency format (two decimal places)<br \/>\n,<br \/>\nPunctuated at thousands (using U.S. format)<br \/>\n%<br \/>\nPercentage format<br \/>\n()<br \/>\nParentheses around negative numbers<br \/>\nnumber<br \/>\nNumber of digits of precision<br \/>\n<strong>Usage<\/strong><br \/>\nIf the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\nOnce a number value is converted to text, you will not be able to use the number for arithmetic calculations.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 123.45.<br \/>\n@Text(123.45)<br \/>\nThis example returns $800.00 if the value in the Sales field is 800.<br \/>\n@Text(Sales;&#8221;C,2&#8243;)<br \/>\nThis example returns 8.00E+02.<br \/>\n@Text(800;&#8221;S&#8221;)<br \/>\nThis example returns 8.00E+02 and -6.00E+02 in a list.<br \/>\n@Text(800 : (-600);&#8221;S&#8221;)<br \/>\nThis example returns 04\/11\/93 10:43 AM.<br \/>\n@Text(@Now)<br \/>\nThis example returns 04\/11.<br \/>\n@Text(@Now;&#8221;D1S0&#8243;)<br \/>\nThis example returns 10:43:30 AM.<br \/>\n@Text(@Now;&#8221;D1S1&#8243;)<br \/>\nThis example returns 04\/93 10:43 AM.<br \/>\n@Text(@Now;&#8221;D3T1&#8243;)<br \/>\nThis example returns the rich-text Body field stripped of attachments and formatting.<br \/>\n@Text(Body)<br \/>\nTo convert a number date (in the ShipDate field) into a written date, you can use the following code. If ShipDate contains [08\/31\/2002], the result is &#8220;August 31, 2002.&#8221;<br \/>\n@If( @IsTime(ShipDate);<br \/>\n@Text(@Select(@Month(ShipDate); &#8220;January&#8221;; &#8220;February&#8221;; &#8220;March&#8221;; &#8220;April&#8221;; &#8220;May&#8221;; &#8220;June&#8221;; &#8220;July&#8221;; &#8220;August&#8221;; &#8220;September&#8221;; &#8220;October&#8221;; &#8220;November&#8221;;&#8221;December&#8221;))+ &#8221; &#8221; +<br \/>\n@Text(@Day(ShipDate)) + &#8220;, &#8221; + @Text(@Year(ShipDate));<br \/>\n &#8220;No date given&#8221;)<\/p>\n<h3>@Today<\/h3>\n<p>Returns today&#8217;s date.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Today<br \/>\n<strong>Return value<\/strong><br \/>\ntoday<br \/>\nTime-date. Today&#8217;s date.<br \/>\n<strong>Usage<\/strong><br \/>\nThis function is identical to the formula @Date(@Now). It is usually used in default value formulas to automatically enter the current date.<br \/>\nUsing @Today in column or selection formulas may impact the efficiency of your application. It also causes the view refresh indicator to display constantly.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 02\/19\/93 if today is February 19, 1993.<br \/>\n@Today<br \/>\nThis example sets the field named ReceivedDate to today&#8217;s date.<br \/>\nFIELD ReceivedDate:=@Today<\/p>\n<h3>@Weekday<\/h3>\n<p>Computes the day of the week and returns a number that identifies the day.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Weekday( time-date )<br \/>\n<strong>Parameters<\/strong><br \/>\ntime-date<br \/>\nTime-date or time-date list. The date having the weekday value you want.<br \/>\n<strong>Return value<\/strong><br \/>\nweekdayNumber<br \/>\nNumber or number list. Weekday numbers are 1 through 7, with Sunday = 1, Monday = 2, and so on.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 5.<br \/>\n@Weekday([9\/29\/88])<br \/>\nThis example returns 2 if the date in the response field happens to fall on a Monday.<br \/>\n@Weekday(ResponseDate)<\/p>\n<h3>@Year<\/h3>\n<p>Extracts and returns the year from the specified time-date value.<br \/>\n<strong>Syntax<\/strong><br \/>\n@Year( time-date )<br \/>\n<strong>Parameters<\/strong><br \/>\ntime-date<br \/>\nTime-date or time-date list. The time-date of the year you want.<br \/>\n<strong>Return value<\/strong><br \/>\nyear<br \/>\nNumber or number list. The year of time-date. @Year returns the year relative to the time zone in which the date was generated. Returns -1 if the time-date provided contains only a time value and not a date.<br \/>\n<strong>Usage<\/strong><br \/>\nIf the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.<br \/>\n<strong>Examples<\/strong><br \/>\nThis example returns 1995.<br \/>\n@Year([9\/29\/95])<br \/>\nThis example returns 1995 and 2008.<br \/>\n@Year([9\/29\/95] : [9\/29\/08]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WEHOOP uses the Formulas Language similar to Excel to perform operations, calculations and comparisons in a form that remains simple.<\/p>\n","protected":false},"author":3,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[186],"ht-kb-tag":[],"class_list":["post-2728","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-d-guide"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/wiki.wehoop.com\/en\/wp-json\/wp\/v2\/ht-kb\/2728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiki.wehoop.com\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/wiki.wehoop.com\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/wiki.wehoop.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/wiki.wehoop.com\/en\/wp-json\/wp\/v2\/comments?post=2728"}],"version-history":[{"count":0,"href":"https:\/\/wiki.wehoop.com\/en\/wp-json\/wp\/v2\/ht-kb\/2728\/revisions"}],"wp:attachment":[{"href":"https:\/\/wiki.wehoop.com\/en\/wp-json\/wp\/v2\/media?parent=2728"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/wiki.wehoop.com\/en\/wp-json\/wp\/v2\/ht-kb-category?post=2728"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/wiki.wehoop.com\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=2728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}