Table of Contents Previous Next Index

Section 18 Calculation Formulas

Section 18 Calculation Formulas
In LISTSERV Maestro, calculation formulas are currently available in the context of the special *Calc system drop-in, in the condition tree of target groups of type "Dataset" or "Hosted Recipient List", and in the derivation rule of a derived profile field in a dataset or hosted recipient list. The syntax and semantics of these calculation formulas are described here.
A formula is a sequence of expressions that are combined with operators into more complex expressions. Expressions can be optionally nested with parenthesis and make use of a few pre-defined functions.
Examples for formulas are:
15 + 4
27 * Max(17, 4, 24/8) / (19 + 22)
&NAME; + "@lsoft.com"
(ToNum(&AGE;) – 2004) * 10
ToDate(CurrentTimeMillis, "MM/dd/yyyy HH:mm")
The following sub-sections explain all aspects of formulas in detail.
18.1 Data Types
Calculation values can now be one of five different data types:
Number – The value is an integer number in the following range:
-9223372036854775808 to 9223372036854775807
Note that floating point numbers are not possible in LISTSERV Maestro formulas.
Text – The value is a character string that may contain any sequence of characters, including an empty sequence.
Boolean – The value is a boolean value, either true or false.
Number Set – The value is a set of numbers that is a collection of distinct values of the type number. That is, each number can be contained only once. The set can either have no elements (an empty set), single elements, or any number of elements.
Text Set – The value is a set of text strings. Similar to a number set, a text set is a collection of distinct values of the text type that can have zero, one, or several elements.
18.2 Automatic Type-Conversion
Operators and functions usually require their operands and arguments to be of a certain type. However, under some circumstances it is possible to supply an expression of a different type as an operand or argument, which will then automatically be converted to the required type.
Automatic conversion to Text – Whenever an operand or argument of type Text is required, an expression either of type Text or of type Number can be supplied. In the latter case, the number will then first be converted into a text before the operator or function is applied. For this conversion, the number-value is simply converted into the corresponding string representation, for example the number 157 becomes the text string "157".
Automatic conversion to Number Set – Whenever an operand or argument of type Number Set is required, an expression either of type Number Set or of type Number can be supplied. In the latter case, the number will then first be converted into a number set with a single element, before the operator or function is applied.
Automatic conversion to Text Set – Whenever an operand or argument of type Text Set is required, an expression either of type Text Set, Number Set, Text or Number can be supplied. In the latter cases, a conversion to Text Set will be performed before the operator or function is applied:
A Number Set is converted into a Text Set by converting each single number element into a text element (see "conversion to Text" above).
A Number is converted into a Text Set by creating a Text Set with the single number as the only element, where the number in turn is first converted into a text.
18.3 Expressions
Operands and function arguments can appear in different "expressions", which are described in the following sub-sections.
18.3.1 Constant Number Expressions
Restriction: None. Constant number expressions can be used in any formula.
Type: Constant number expressions are, as the name implies, always of the type “number”.
Usage: To include a constant number in a formula, simply type the number using only the digits “0­­“-“9” (do not use “,” as a thousands-separator or “.” as a decimal point). Negative numbers must have a leading minus sign “-“.
Examples:
1
0
537
-17
007
18.3.2 Constant Text Literal Expressions
Restriction: None. Constant text literal expressions can be used in any formula.
Type: Constant text literal expressions are, as the name implies, always of the type “text”.
Usage: To include a text literal in a formula, type the characters desired, and then denote the beginning and the end of the text literal by enclosing the whole string in quotation marks <">. There must not be any linebreaks in the text string.
Since the text literal must be quoted, it must also follow the rules for quote escaping. See Section 16 Advanced Use of System Drop-Ins for details.
Examples:
"example"
"this is a text string"
"This string contains ""quotes"" which are therefore escaped"
" this string has three spaces at the beginning and end "
18.3.3 Constant Boolean Expressions
Restriction: None. Constant boolean expressions can be used in any formula.
Type: Constant boolean expressions are, as the name implies, always of type Boolean.
Usage: To include a constant boolean in a formula, simply type either "true" or "false" (without the quotes).
Examples:
true
false
18.3.4 Standard Merge Field Expressions
Restriction: Standard merge field expressions are only allowed if the formula is used in one of the following contexts:
In a *Calc system drop-in of a job with the following recipient types:
If the system drop-in is used in a job with a different recipient type, the formula must not contain any merge field expressions. If it does, an error message will be displayed about this during test delivery.
Type: Standard merge field expressions can be of type Number, Text, Boolean or Text Set, depending on their context and content (see "Type Determination" below for details).
Usage: To include a standard merge field in a formula, type the merge field name enclosed in (&) and (;). Only use merge field names that are actually defined in the recipient list.
Examples:
&NAME;
&STATE;
&ACCOUNT_BALANCE;
Type Determination: Whenever any such merge field appears in a formula, it will first be replaced with the field value for the current recipient. This occurs before the result of the formula is calculated for that recipient. To be able to do this calculation, the expression's type is determined as follows:
If the formula is used in the condition tree of a "Dataset" or "Hosted Recipient List" target group or in a *Calc system drop-in together with recipients based on such a target group, then the type of each merge field is already defined by the profile field's type, which was defined during creation of the associated dataset or hosted recipient list:
This determination of the type is already done during parsing of the formula.
If the formula is used in a *Calc system drop-in with the recipients types "uploaded CSV text file" or "LISTSERV Maestro selects from a database", then the type of the field is determined by the field's content as follows:
If the field's content can be interpreted as a number, the type Number will be used. If it cannot be interpreted as a number (or is empty), the type Text will be used (which for an empty content will then be an empty text string).
Consequently, if the merge field appears in a location of the formula where a Number type is expected, you need to ensure that the field's content can be interpreted as a number for all recipients. Otherwise, the field will have the type Text for some recipients, which would usually cause the calculation of the formula and the delivery of the job to fail.
This determination of the type is done during delivery, when the merge-values of all recipients are known.
Special Note for "Datasets" and "Hosted Recipient Lists": If the formula is used in the condition tree of a "Dataset" or "Hosted Recipient List" target group or in a *Calc system drop-in together with recipients based on such a target group, then there are special rules for profile fields of type "Number" or "Text". If such a profile field is defined in the dataset or hosted recipient list as "optional" then this field can not be used in a "standard merge field" expression. Instead, use the "optional merge field" expression instead (see next section.)
18.3.5 Optional Merge Field Expressions
Restriction: Optional merge field expressions are only allowed if the formula is used in one of the following contexts:
In a *Calc system drop-in of a job with the following recipient types:
If the system drop-in is used in a job with a different recipients type, the formula must not contain any merge field expressions. If it does, an error message will be displayed about this during test delivery.
Type: Optional merge field expressions can either be of type Number" or of type Text, depending on their context and content (see "Type Determination" below for details).
Usage: Optional merge fields are fields that may be undefined (empty) for at least some recipients in the recipient list. If such a field would be used normally in a formula, it would not be possible to calculate the result of the formula for those recipients. Therefore, such "possibly undefined" fields must be included as "optional merge field" expressions, not as "standard merge field" expressions. An optional merge field expression is written in the following way:
[&FIELD_NAME; DEFAULT]
The whole expression must be enclosed in brackets "[" and "]". Between the brackets the name of the merge field to be addressed appears first, enclosed with (&) and (;), then the default content that will be used for all recipients where the merge field itself is undefined.
The default that replaces "DEFAULT" as given above must either be a constant number or a constant text literal.
Examples:
[&NAME; "no name"]
[&NAME; ""]
[&STATE; "n/a"]
[&ACCOUNT_BALANCE; 0]
Note: The second example defines an empty text as the default for &NAME;.
Type Determination: Whenever any such merge field appears in a formula, it will first be replaced with the field value for the current recipient, or if that value is undefined or empty, it will be replaced with the given default. Next, the result of the formula is calculated for that recipient. To be able to do this calculation, the expression's type is determined just like for "standard merge field" expressions.
In addition, if the field's value is empty or undefined, the type will be determined by the type of the given default. Therefore, make sure that the type of the default matches the field's type or is at least convertible to that type.
Special Note for "Datasets" and "Hosted Recipient Lists": If the formula is used in the condition tree of a "Dataset" or "Hosted Recipient List" target group or in a *Calc system drop-in together with recipients based on such a target group, then only profile fields of type "Number" or "Text" can be used in an "optional merge field" expression, and also only if that field is actually defined as "optional". For fields of other types, or for fields that are defined as "mandatory", use the "standard merge field" expression instead (see previous section.)
18.3.6 Function Expressions
Restriction: Functions can usually be used in any formula. However, there may be individual restrictions that apply only to certain functions. See the function descriptions for details.
Type: The type depends on each function. See the function descriptions for details.
Usage: To include a function in a formula, simply type the function name possibly followed by an argument list in parenthesis. See the function description for details concerning whether arguments are required by a certain function and what they mean.
Note: Function names are case sensitive and any parenthesis enclosing the argument list must immediately follow the function name, without any space in between.
Examples:
Abs(-20)
Max(15, &AGE;)
ToLower("Convert this string to ALL Lowercase")
Min(-10, -11, &SIZE_A;, &SIZE_B;)
Available Functions: The currently available functions are described in Formula Functions.
18.3.7 Target Group Parameter Expressions
Restriction: Target group parameter expressions are only allowed if the formula is used in the condition tree of a "Dataset" or "Hosted Recipient List" target group. They must not be used in a formula of a *Calc system drop-in.
Type: Either Number or Text, depending on how the parameter is specified (see below).
Usage: A target group parameter is a parameter that is specified during target group definition, but whose value is not yet known at that time. The parameter will later be "filled out" with content by a user choice made in the recipients wizard, when the target group is used for recipient definition.
To include a target group parameter in a formula, simply type the name of the parameter enclosed in double curly brackets "{{" and "}}". The parameter name must only contain the characters "A" to "Z", "a" to "z", "0" to "9" and the underscore "_".
For the formula it is also important to know the type (either Number or Text) with which the final content of the parameter will be interpreted:
If a parameter is enclosed with quotes (") like a text string, its content is interpreted as Text. If it is not enclosed in quotes, its content is interpreted as Number, so it is important to make sure that all possible parameter values are indeed valid numbers (for type "number").
Notes: If you include the same parameter name several times in the same formula, it will be interpreted as one parameter that simply appears several times. All appearances will have the same content value and must also all appear in the same type context as Number or Text and they must either all be enclosed in quotes to be interpreted as Text parameters, or none of them must be enclosed in quotes (to be interpreted as Number).

Similarly, if a parameter is used with the same name in the same target group but outside of a formula or in a different formula, then all these appearances of the parameter name (in the same target group) will reference the same parameter. All of them will be replaced with the same final content during usage in the recipients wizard.
Examples:
{{param}}
{{my_number_param}}
"{{a_text_param}}"
{{Param10}}
18.4 Operators
All operators have been updated to support the new data types and new calculation formula features.
18.4.1 Operators for Number Operands
If both operands are of the Number type, then you can use the following operators:
Table 4-1 Operators for Number Operands
Negative Value (unary operator with one operand)
The negative value of the operand. This operator has only a single operand, at the right side of the operator.
"True" if the two operands are not the same number, "false" otherwise. This operator can also be written as "^=".
Note: In LISTSERV Maestro, division is strictly an integer division; therefore, any decimal places in the result are discarded (not rounded off, but simply ignored).
18.4.2 Operators for Text Operands
If one operand is of the Text type and the other is either of the Text or Number type, then you can use the following operators:
Table 4-2 Operators for Text Operands
A new text string that is created by appending the second operand text to the first operand text.
"True" if the two operands are not the same text, "false" otherwise. This operator can also be written as "^=".
Notes: If only one operand is of the Text type and the other is of the Number type, then this number operand will automatically be converted into a text before the operator is applied.

Text comparisons are case sensitive, so "this" is not equal to "THIS".

Also the "less-than" and "greater-than" comparisons are based on the character ordering of the Unicode standard, which makes a difference between lowercase and uppercase characters. For example, even though "ABC" < "XYZ" is true, "abc" < "XYZ" is not true, because in Unicode all uppercase characters come before all lowercase characters.

If you need to perform a case insensitive comparison, you should first convert both operands to the same case (either lowercase or uppercase) using the "ToLower(arg)" or "ToUpper(arg)" functions.
18.4.3 Operators for Boolean Operands
If both operands are of type Boolean, then you can use the following operators:
Table 4-3 Operators for Boolean Operands
"True" if the operand is "false", "false" otherwise. This operator has only a single operand, at the right side of the operator.
"True" if the two operands have different boolean values, "false" otherwise. This operator can also be written as "^=".
18.4.4 Operators for Set Operands
If one of the operands if of type Set, and the other operand is not of type Boolean, then you can use the following operators:
Table 4-4 Operators for Set Operands
A set that contains all elements from the first operand set that are not in the second operand set.
"True" if the two operands are not the same set; otherwise, “false”. This operator can also be written as “^=”.
"True" if the first operand is a proper (or strict) subset of the second operand set (all values from the first set are also contained in the second set, and the second set has additional other values).
"True" if the first operand is a subset of the second operand set (all values from the first set are also contained in the second set, where the two sets may also be the same).
"True" if the first operand is a proper (or strict) superset of the second operand set (all values from the second set are also contained in the first set, and the first set has additional other values).
"True" if the first operand is a superset of the second operand set (all values from the second set are also contained in the first set, where the two sets may also be the same)
If only one operand is of type Set and the other is of type Text or Number, or if both operands are sets, but one is of type Number Set and the other of type Text Set, then the following conversion will automatically be performed before the operator is applied:
One operand is of type Text Set: Depending on the type of the other operand, one of the following conversions may be performed:
Number – The number operand is converted into a text set by creating a new set with a text representation of the number as the single element of the set. After this, both operands are of type Text Set and the set operator can be applied to them.
Text – The text operand is converted into a text set by creating a new set with the text as the single element of the set. After this, both operands are of type Text Set and the set operator can be applied to them.
Number Set – The number set operand is converted into a text set by creating a new set that contains text representations of all numbers in the number set. After this, both operands are of type Text Set and the set operator can be applied to them.
Text Set – No conversion necessary. Both operands are of type Text Set anyway and the set operator can be applied to them.
One operand is of type Number Set: If the other operand is of type Text Set, then we are dealing with a case that was already described above. If the other operand is not of type Text Set, then depending on the type of the other operand, one of the following conversions may be performed:
Number – The number operand is converted into a number set by creating a new set with the number as the single element of the set. After this, both operands are of type Number Set and the set operator can be applied to them.
Text – The text operand is converted into a text set by creating a new set with the text as the single element of the set. In addition, the Number Set argument itself is also converted into a text set by creating a new set that contains text representations of all numbers in the number set. After this, both operands are of type Text Set and the set operator can be applied to them.
Number Set – No conversion necessary. Both operands are of type Number Set anyway and the set operator can be applied to them.
18.4.5 Operator Precedence and Parenthesis
Formulas are processed by LISTSERV Maestro following the usual mathematical conventions.
Operators with higher precedence are processed first. If several operators with the same precedence level are encountered, they are processed from left to right. Parenthesis can be set freely to influence precedence where inner parenthesis will be processed before outer parenthesis.
Operator precedence is defined as follows (from highest to lowest, operators on the same row have the same precedence level):
Examples:
15 + 3 * 4 Result: 27
8 * (7 - 3) Result: 32
17 * 22 / 2 % 5 Result: 2
17 * (22 / 2 % 5) Result: 17
17 * (22 / (2 % 5)) Result: 187
18.5 Formula Functions
The functions described in this section are currently available in LISTSERV Maestro. The available functions are:
Number Functions:
Abs – Converts a number into its absolute (non-negative) number.
IsNum – Checks if the given argument can be converted into a number.
Max – Finds the largest of several numbers.
Min – Finds the smallest of several numbers.
Pow – Raises a number to a specified power.
Random – Generates a random number.
ToNum – Converts any non-number data type into a number.
Text Functions:
Contains – Checks if one text contains another.
EndsWith – Checks if a text ends with a certain text suffix.
HTMLEncode – Encodes all HTML-unsafe characters in a text.
EndsWith – Finds the first (or next) occurrence of one text in another.
LastIndexOf – Finds the last (or previous) occurrence of one text in another.
Length – Determines the length of a text.
Matches – Determines if a text matches a certain "regular expression".
ReplaceText – Replaces all occurrences of a certain sub-string in a text with a new string.
Substring – Extracts a specified substring from a text.
StartsWith – Checks if a text starts with a certain text prefix.
ToLower – Converts a text into all lowercase.
ToUpper – Converts a text into all UPPERCASE.
Trim – Trims leading and trailing whitespace from a text.
URLEncode – Encodes all URL-unsafe characters in the text.
Boolean Functions:
If – Evaluates a condition and determines one of two possible values as a result.
Set Functions:
Count – Counts all elements in a set.
In – Determines if a set contains a certain element.
SetOf – Builds a set out of a list of elements.
SetToString – Converts a set into a string by listing all elements in the set.
SetToStringWithMaxLen – Converts a set into a string (with a maximum length) by listing all elements in the set.
Date/Time Functions:
CurrentMillis – Determines the current date/time, in milliseconds.
IsDate – Checks if a textual date/time representation is valid.
SubscribeTimeMillis – Determines the subscription date/time of a hosted subscriber, in milliseconds.
ToDate – Converts a milliseconds time value into a textual date/time representation.
ToMillis – Converts a textual date/time representation into a milliseconds time value.
Other Functions:
IsSupplied – Checks if a certain merge field has a value or not.
SecondaryValue – Retrieves the secondary values for a single/multiple select profile field.
Abs
Abs(arg)
Function: Returns the absolute value of the given Number or Number Set argument.
Return-Type: Number or Number Set
Arguments:
arg - This argument can be of type Number or Number Set and its absolute value is to be determined. If a single number is given, then the absolute value of that number is returned. If a set of numbers is given, then a Number Set is returned that contains the absolute values of all numbers in the argument set.
Examples:
Abs(-10)
Abs(&VALUE;)
Abs(30 - &ACCOUNT; * 2)
Abs(SetOf(10, -333, 15, &VALUE1;, &VALUE2;))
IsNum
IsNum(arg)
Function: Checks if the given argument can be converted into a number or set of numbers. Returns "true" if the argument can be converted into a number or set of numbers, "false" if not.
This function is a companion function to “ToNum”: If IsNum returns "true" for a given argument, then it is safe to use ToNum on the same argument (i.e. ToNum will not generate an error when used with the same argument).
Return-Type: Boolean
Arguments:
arg - This argument can be of any type:
Text: The text is parsed and an attempt is made to convert it into a number. If this is successful, then "true" is returned, otherwise "false".
Text Set: All elements in the set are parsed and converted into numbers. If this is successful for all elements in the set, then "true" is returned, otherwise "false".
Boolean: Always results in a return value of "true".
Number or Number Set: Always results in a return value of "true".
Examples:
IsNum("12345")
IsNum(&AGE;)
IsNum(true)
IsNum("123" + "456")
Max
Max(arg1 [, arg2, ... , argN])
Function: Returns the greatest of all given Number arguments.
Return-Type: Number
Arguments:
arg1 - This argument can be of type Number or Number Set, and its the first argument to find the maximum of. (Further arguments are optional.)
arg2 - This argument can be of type Number or Number Set, and its the second argument to find the maximum of.
argN - This argument can be of type Number or Number Set and is the Nth argument to find the maximum of. If any of the arguments are a set of numbers, then the maximum will be determined over all numbers in this set (and any other arguments, if present).
Examples:
Max(3, -4)
Max(17, 22, 4)
Max(82, &VALUE; * 7)
Min
Min(arg1 [, arg2, ... , argN])
Function: Returns the smallest of all given Number arguments.
Return-Type: Number
Arguments:
arg1 - This argument can be of type Number or Number Set, and its the first argument to find the minimum of. (Further arguments are optional.)
arg2 - This argument can be of type Number or Number Set, and its the second argument to find the minimum of.
argN - This argument can be of type Number or Number Set, and its the Nth argument to find the minimum of. If any of the arguments is a set of numbers, then the minimum will be determined over all numbers in this set (and any other arguments, if present).
Examples:
Min(13, 2)
Min(16, 29, 4)
Min(72, &VALUE; * 5)
Pow
Pow(base, exp)
Function: Returns the value of the first argument raised to the power of the second argument.
Return-Type: Number
Arguments:
base - This argument can be of type Number, and its the base argument.
exp - This argument can be of type Number, and its the exponent argument.
Examples:
Pow(2, 8)
Pow(&BASE;, &EXPONENT;)
Random
Random[(threshold)]
Function: Returns a pseudo-random number in a range specified by the argument. If no argument is given, then the range is from 0 to the largest possible Number value. If one argument given, then the range is from 0 to the value of the given argument minus one (i.e. "0" to "arg-1").
Return-Type: Number
Arguments: (The argument is optional)
threshold - This argument can be of type Number, and its the threshold value for the random number. The random number will range from "0" to "threshold - 1".
Examples:
Random
Random(6)
Random(&MAX_RANDOM;)
Random(&VALUE; - 17 * &MAX;)
ToNum
ToNum(arg)
Function: Tries to convert the given argument into a number or set of numbers. It generates a runtime error if that is not possible (for example, if the argument is a text that contains characters that are not part of a number representation, like letters). If you are unsure if a certain argument can be converted into a number without an error, and you want to avoid this error, then use the companion function IsNum to first check if the argument can be converted at all, together with the function If.
This function can, for example, be used to convert a profile field of type Text, which only contains numbers, to the type Number, which can then be used in contexts that require the type Number (such as number operators and functions that require a number argument).
Return-Type: Number or Number Set
Arguments:
arg - This argument can be of any type:
Text: The text is parsed and an attempt is made to convert it into a number. This is possible if the text contains only digits and optionally a leading minus sign (otherwise an error is generated). A single number is returned.
Text Set: All elements in the set are parsed and converted into numbers (if possible, otherwise an error is generated). A Number Set that contains all these numbers is returned.
Boolean: The boolean value "true" is converted into the number "1", the boolean value "false" is converted into the number "0". This number is then returned.
Number or Number Set: The argument is returned unchanged.
Examples:
ToNum("12345")
ToNum(&AGE;)
ToNum(true)
ToNum("123" + "456")
If(IsNum(&TEXTFIELD;), ToNum(&TEXTFIELD;), 0)
Notes: The result of the second-to-last example will not be the number 579, but will instead be the number 123456. The string concatenation operator "+" is first applied to the two text strings and then the resulting string is converted into a number.
The last example shows how ToNum is used together with IsNum and If, to make sure that no runtime error is generated: If the field TEXTFIELD contains a number, then this number is supposed to be used. If not, then instead the default of "zero (0)" is to be used. So the result of this If function is in turn a number: Either the number that was parsed from TEXTFIELD, or the number "0". Thus, the result of the If function can safely be used in a context where a Number type is required, without fearing a runtime error if TEXTFIELD should contain a non-number text.
Contains
Contains(text, searchfortext)
Function: Checks if "text" contains an appearance of "searchfortext". It returns "true" if the text is found, "false" if not.
Return-Type: Boolean
Arguments:
text - This argument can be of type Text, and its the text string to search in.
searchfortext - Type Text: The string to search for.
Examples:
Contains("a longer text", "longer")
Contains(&VALUE;, "sample")
EndsWith
EndsWith(text, suffix)
Function: Checks if "text" ends with the given "suffix", i.e. if the last characters in "text" are equal to the characters in "suffix". Returns "true" if the suffix matches, "false" if not.
Return-Type: Boolean
Arguments:
text - This argument can be of type Text, and its the text string whose suffix is to be checked.
suffix - This argument can be of type Text, and its the suffix to check for.
Examples:
EndsWith("a longer text", "text")
EndsWith(&VALUE;, "xyz")
HTMLEncode
HTMLEncode(arg)
Function: Returns the given text argument (or set of texts) with the following characters which are unsafe to use in a HTML context encoded into HTML entities, so that the resulting text can be safely included in a HTML context:
< becomes &lt;
> becomes &gt;
& becomes &amp;
" becomes &#34;
Return-Type: Text or Text Set
Arguments:
arg - This argument can be of type Text or Text Set. If a single text is given, then this text is encoded and the result is returned. If a set of texts is given, then all texts in the set will be encoded and a set with these encoded texts is returned.
 
Examples:
HTMLEncode("This text contains <characters>, which are not safe in HTML & need to be encoded")
IndexOf
IndexOf(text, searchfortext [, startindex])
Function: Searches for an occurrence of the text "searchfortext" in the given "text". Returns the zero-based index of the first occurrence of "searchtext", or "-1" if none was found. Optionally a zero-based "startindex" can be specified with the effect that the search in "text" will not start at the beginning of "text" but at the character position specified by "startindex".
Return-Type: Number
Arguments:
text - This argument can be of type Text, and its the text string to search in.
searchfortext - This argument can be of type Text, and its the string to search for.
startindex - This argument can be of type Number, and its the character position at which the search will be started. If not given, the search will always start at the first character (index "0"). This argument is optional.
Examples:
IndexOf("a longer text", "lo")
IndexOf("abc def abc def", "abc", 4)
LastIndexOf
LastIndexOf(text, searchfortext [, startindex])
Function: Searches for an occurrence of the text "searchfortext" in the given "text", starting at the end of "text". Returns the zero-based index of the last occurrence of "searchtext", or "-1" if none was found. Optionally a zero-based "startindex" can be specified with the effect that the search in "text" will not start at the end of "text" but at the character position specified by "startindex" (and then proceed towards the start of "text").
Return-Type: Number
Arguments:
text - This argument can be of type Text, and its the text string to search in.
searchfortext - This argument can be of type Text, and its the string to search for.
startindex - This argument can be of type Number, and its the character position at which the search will be started. If not given, the search will always start at the last character (index "length - 1"). This argument is optional.
Examples:
LastIndexOf("a longer text", "lo")
LastIndexOf("abc def abc def", "abc", 4)
Length
Length(text)
Function: Returns the length of the given text string (the number of characters in the text).
Return-Type: Number
Arguments:
text - This argument can be of type Text, and its the text whose length shall be determined.
Examples:
Length("text")
Length("a longer text")
Length(&FULL_NAME;)
Matches
Matches(text, regexp)
Function: Checks if "text" matches the regular expression in "regexp". Returns "true" if the text matches, "false" if not.
A regular expression, which can be seen as a "pattern", is an expression that describes a set of texts. With this expression, the desired set can be described without having to list all elements. Therefore, The Matches function actually does nothing else than to check if the given "text" is among the set of texts that is defined by the regular expression in "regexp".
To be able to describe a whole set of texts with a single expression, regular expressions make intensive use of special character constructs, like for example wildcards, quantifiers, boundary matchers and others. The topic of regular expressions is a very wide field. For the regular expression constructs that are supported by LISTSERV Maestro, please see the online help.
Return-Type: Boolean
Arguments:
text - This argument can be of type Text, and its the text string to match.
regexp - This argument can be of type Text, and it the regular expression to use.
Examples:
Matches("a longer text", "longer")
Matches(&VALUE;, "sample")
ReplaceText
ReplaceText(arg, oldtext, newtext)
Function: Searches for all occurrences of "oldtext" in the given "arg" and replaces these occurrences with "newtext". If "arg" is a single text, then the replacement is performed in this text and the result is returned. If "arg" is a Text Set, then the replacement is performed individually on all texts in the set and the resulting set is returned.
Return-Type: Text or Text Set
Arguments:
arg - This argument can be of type Text or Text Set, and its the text (or set of texts) to search in.
oldtext - This argument can be of type Text, and its the text that will be replaced.
newtext - This argument can be of type text, and its the text that will replace all occurrences of "oldtext".
Examples:
ReplaceText("abc def abc def", "abc", "xyz")
Substring
Substring(originaltext, startindex [, endindex])
Function: Returns a text substring that has been extracted from the given original text string according to the other argument(s) as specified:
The substring begins with the character in "originaltext" at the position specified by "startindex".
If no "endindex" is given, the substring extends to the end of the original string. If "endindex" is given, the substring extends to the character at position "endindex - 1" (i.e. the character at "endindex" is the first character that is not part of the substring).
Note: All indices are zero-based. The index of the last character in the original string is at the position "length of original string minus 1".
Return-Type: Text
Arguments:
originaltext - This argument can be of type Text, and its the original text string from which the substring will be extracted.
startindex - This argument can be of type Number, and its the beginning index, inclusive, zero-based.
endindex - This argument can be of type Number, and its the ending index, exclusive, zero-based. This argument is optional.
Examples:
Substring("original text", 5)
Substring("original", 3, 3 + &VALUE;)
StartsWith
StartsWith(text, prefix)
Function: Checks if "text" starts with the given "prefix", i.e. if the first characters in "text" are equal to the characters in "prefix". Returns "true" if the prefix matches, "false" if not.
Return-Type: Boolean
Arguments:
text - This argument can be of type Text, and its the text string whose prefix is to be checked.
prefix - This argument can be of type Text, and its the prefix to check for.
Examples:
StartsWith("this is a longer text", "this")
StartsWith(&VALUE;, "abc")
ToLower
ToLower(arg)
Function: Returns the given text argument (or set of texts) with all letters converted to lowercase letters.
Return-Type: Text or Text Set
Arguments:
arg - This argument can be of type Text or Text Set. If a single text is given, then this text is converted to lowercase and the result is returned. If a set of texts is given, then all texts in the set will be converted to lowercase and a set with these converted texts is returned.
Examples:
ToLower("Convert All UPPERCASE to Lowercase")
ToUpper
ToUpper(arg)
Function: Returns the given text argument (or set of texts) with all letters converted to UPPERCASE letters.
Return-Type: Text or Text Set
Arguments:
arg - This argument can be of type Text or Text Set. If a single text is given, then this text is converted to uppercase and the result is returned. If a set of texts is given, then all texts in the set will be converted to uppercase and a set with these converted texts is returned.
Examples:
ToUpper("convert all lowercase to uppercase")
Trim
Trim(arg)
Function: Trims leading and trailing whitespace from the given text argument (or set of texts), i.e. returns a text (or set of texts) where all leading and trailing whitespace has been removed. This functions interprets all characters with an ASCII-value of 32 (20h) or lower as whitespace.
Return-Type: Text or Text Set
Arguments:
arg - This argument can be of type Text or Text Set. If a single text is given, then this text is trimmed and the result is returned. If a set of texts is given, then all texts in the set will be trimmed and a set with these trimmed texts is returned.
Examples:
Trim(" this text has whitespace at beginning and end ")
URLEncode
URLEncode(arg)
Function: Returns the given text argument (or set of texts) with all characters that are unsafe to be used in a URL parameter encoded in URL-safe form, so that the resulting text can be safely included in a URL or as a URL parameter.
Return-Type: Text or Text Set
Arguments:
arg - This argument can be of type Text or Text Set. If a single text is given, then this text is encoded and the result is returned. If a set of texts is given, then all texts in the set will be encoded and a set with these encoded texts is returned.
Examples:
URLEncode("This text contains characters like '=', '?' and '&' which are not URL-safe and need to be encoded")
If
If(condition, value1, value2)
Function: Evaluates the "condition" and returns either the "value1" (if the condition is "true") or the "value2" (if the condition is "false").
Return-Type: Depends on "value1" and "value2" (see below).
Arguments:
condition - This argument can be of type Boolean, and its the condition to evaluate.
value1 - This argument can be of any type (see below), and its the value to return if the condition evaluates to "true".
value2 - This argument can be of any type (see below), and its the value to return if the condition evaluates to "false".
Note: Even though "value1" and "value2" can be of any type, the types of these two values must either be the same, or one type must be convertible into the other. If both types are the same, then this is also the return type of the function. If the types are different, but one type can be converted into the other type, then this other type is the return type of the function (even if the value with the first type should be selected by the condition). For details on conversions, see Automatic Type-Conversion.
Examples:
If(&VALUE; > 15, "greater than 15", "not greater than 15")
If(&VALUE; + 20 = 50, 50, 0)
Count
Count(set)
Function: Counts and returns the number of elements in the given set.
Return-Type: Number
Arguments:
set - This argument can be of type Text Set or Number Set, and its the set to count the elements of.
Examples:
Count(SetOf("elem1", "elem2", "elem3"))
Count(SetOf(1, 2, 3, 4, 5))
Count(&MULTI_SELECT_FIELD;)
In
In(element, set)
Function: Checks if the given "element" is contained in the given "set". Returns "true" if the element is found in the set, or "false" if not.
Return-Type: Boolean
Arguments:
element - This argument can be of type Number or Text, and its the element to look for.
set - This argument can be of type Number Set or Text Set, and its the set to search in.
Examples:
In("value", &MULTI_SELECT_FIELD;)
SetOf
SetOf([arg1, ... , argN])
Function: Returns a set that contains all arguments. If some arguments are also sets, then the resulting set will contain all elements from these sets individually (i.e. the resulting set will not contain the other sets themselves as its elements, but rather will contain all elements from these other sets). If no argument is given at all, then an empty set is returned.
Return-Type: Number Set or Text Set, depending on the arguments (see below).
Arguments: (All arguments are optional)
arg1 - This argument can be of any type, except Boolean. The first element to include in the result set.
argN - This argument can be of any type, except Boolean. The Nth (and last) element to include in the result set.
If any of the arguments is of type Text or Text Set, then the resulting set will also be a Text Set. If all arguments are either of type Number or Number Set, then the resulting set will be a Number Set. Arguments of type Boolean are not allowed.
Examples:
SetOf(3, 19882, -4, 3371)
SetOf("abc", "def", "ghi")
SetOf("abc", 15, SetOf("xyz", "qvw"), 28, "def")
SetOf(&VALUE1;, "xyz", &MULTI_SELECT_FIELD;)
SetToString
SetToString(set [, default [, separator [, delimiter [, delimitAll [, delimiterEscape]]]]])
Function: Converts a set into a text string by listing all values in the set (if any), separating them with a specified separator character and optionally also enclosing the values in specified delimiters.
Important: The final result of a formula in a *Calc system drop-in must not exceed the maximum length of 900 characters. Similarly, if the formula is used in the derivation rule of a derived profile field (in a dataset or hosted list), then the result must not exceed the maximum length of 100 characters. Using SetToString in a formula does increase the danger of exceeding these limits, especially if the result of the function is also used as the direct result of the formula (without further processing by other functions), and if the set contains a large number of values (e.g. this may easily be the case if the set is defined by a multiple-select merge field). In such a situation, the mail job delivery may fail (if used in a *Calc system drop-in) or the recalculation of the derived profile field may fail (if used in a derivation rule). If in doubt, it may be better to use the SetToStringWithMaxLen function instead, which allows you to control the output length of the result. If the formula is used in the condition tree of a "Hosted Recipient List" target group, then such a restriction does not apply.
Return-Type: Text
Arguments:
set - This argument can be of type Number Set or Text Set, and its the set that is to be converted into a text.
default - This argument can be of type Text, and it defines the default text that shall be the result of the function if the given set is empty. If not specified, then an empty text string is used as the result for an empty set. This argument is optional.
separator - This argument can be of type Text, and its the separator text that is to appear between two values. The separator will only appear between values, i.e. it will not appear before the first or after the last value. So if the set has less than two elements, the separator will not appear at all. Note, that "separator" may be any text, not only a single character. If not specified, the comma "," is used by default as the separator. This argument is optional but may be supplied if the "default" argument has been supplied too.
delimiter - This argument can be of type Text, and its the delimiter text that is to be used to enclose values. In some situations, it may happen that the values from the set already contain the chosen "separator" as part of their value texts. In such a case, the occurrences of the separator text in the values may be confusing, as such an occurrence may be misinterpreted as an actual separator, after which a new value starts, while it actually is only part of the value. To avoid this, it is possible to enclose the values in delimiters, to better mark the beginning and end of a value (if such a value then contains the separator text, then this does not matter, as the end of the value is no longer marked by the separator, but instead by the delimiter). For this, the "delimiter" argument can be used. If specified, then individual values may be enclosed in the specified delimiter text (depending on the "delimitAll" argument, see below). If a value is enclosed with delimiters, and the value itself also already contains the delimiter text, then this delimiter text is escaped (in a way depending on the "delimiterEscape" argument, see below). Note that "delimiter" may be any text, not only a single character. If not specified, then values are never enclosed with extra delimiters. This argument is optional but may be supplied if the "default" and "separator" arguments have been supplied too.
delimitAll - This argument can be of type Boolean. If set to "true", then all values will be enclosed with the given delimiter text. If set to "false", then only values that actually contain the separator text will be enclosed with delimiters. If not specified, then all values will be enclosed with delimiters (default is "true"). This argument is optional but may be supplied if the "default", "separator" and "delimiter" arguments have been supplied too.
delimiterEscape - This argument can be of type Text, and it defines which text will be used to escape an occurrence of the delimiter text in a value. If a value is enclosed with delimiters, but the value already contains the delimiter text itself, then this contained delimiter text could be confused with the end-delimiter, that ends the value. Therefore, if the delimiter text appears in the value, it needs to be "escaped". The escaping is done by inserting the "delimiterEscape" text just before the delimiter text in the value. If "delimiterEscape" is not specified, then the delimiter text itself will be used for escaping, i.e. this has the effect, that if the delimiter text appears in the value, then it will be escaped by doubling it. For example: If the delimiter text is the standard quote character <">, and the value already contains quotes, like this: <value "contains" quotes>. And if no "delimiterEscape" is specified, so that the default is applied, then the escaped value will contain "doubled" quotes, like this: <value ""contains"" quotes>. If instead for example the backslash is supplied for "delimiterEscape", then the escaped value will look like this: <value \"contains\" quotes>. Note that "delimiterEscape" may be any text, not only a single character. This argument is optional but may be supplied if the "default", "separator", "delimiter" and "delimitAll" arguments have been supplied too.
Examples:
SetToString(&MULTI_SELECT_FIELD;)
SetToString(&MULTI_SELECT_FIELD;, "empty")
SetToString(&MULTI_SELECT_FIELD;, "empty", "; ")
SetToString(&MULTI_SELECT_FIELD;, "empty", "; ", "'")
SetToString(&MULTI_SELECT_FIELD;, "", "; ", "'", false)
SetToString(&MULTI_SELECT_FIELD;, "", "; ", "'", true, "\")
SetToStringWithMaxLen
SetToStringWithMaxLen(set, maxlen [, omissionText [, default [, separator [, delimiter [, delimitAll [, delimiterEscape]]]]]])
Function: This is a specialized version of the SetToString function. SetToStringWithMaxLen also converts a set into a text string, but observes a given maximum text length, by listing only so many values from the set as may fit into the maximum length. Similarly to SetToString, the values are separated with a specified separator character and optionally enclosed in the specified delimiters. If not all values fit the maximum length, then optionally an omission text may be appended.
The SetToStringWithMaxLen function is useful if you want to make sure that the final output length of the converted set does not exceed a certain limit. For example the maximum of 900 characters if the formula is used in a *Calc system drop-in, or 100 characters if the formula is used in the derivation rule of a derived profile field.
Return-Type: Text
Arguments:
set - This argument can be of type Number Set or Text Set, and its the set that is to be converted into a text.
maxlen - This argument can be of type Number, and its the maximum length for the resulting text. If a positive "maxlen" is supplied, then the returned text will never be longer than this value (although it may be shorter if there are not enough elements in the set). If "0" or a negative "maxlen" is supplied, the returned text will always be an empty text string.
omissionText - This argument can be of type Text: If at least one of the elements from the set has to be left out from the enumeration because of the specified "maxlen", then this "omissionText" will be appended to the resulting text, to signify that some values have been left out. this argument is optional.
Note: The length of the omission text also counts against the given maximum length. So if an omission text is to be appended (because some values have been left out), but with the omission text the result would then be too long, then even more values will be left out, until there is enough space to fit in the omission text too. If you do not want an omission text to appear at all, then specify an empty text string "" for this argument.
Special Feature: If inside of the omission text you specify the placeholder #COUNT (with this exact spelling, in all UPPERCASE), then this placeholder will be replaced with the number of omitted elements before the omission text is appended. So if you for example specify the text "and #COUNT more", and in the result twelve elements have been omitted, then the omission text in the result will read "and 12 more". If not specified, then "..." is used as the default omission text. The remaining arguments "default", "separator", "delimiter", "delimitAll" and "delimiterEscape" work exactly as with the SetToString function. Please see there for details. These arguments are optional but may be supplied if the "omissionText" argument has been supplied too.
Examples:
SetToStringWithMaxLen(&MULTI_SELECT_FIELD;, 100)
SetToStringWithMaxLen(&MULTI_SELECT_FIELD;, 100, " and more...", "empty")
SetToStringWithMaxLen(&MULTI_SELECT_FIELD;, 200, " and #COUNT more...", "empty", "; ")
SetToStringWithMaxLen(&MULTI_SELECT_FIELD;, 200, "", "empty", "; ", "'")
SetToStringWithMaxLen(&MULTI_SELECT_FIELD;, 200, "", "", "; ", "'", false)
SetToStringWithMaxLen(&MULTI_SELECT_FIELD;, 200, "", "", "; ", "'", true, "\")
CurrentMillis
CurrentMillis
Function: Returns the current time, in milliseconds since "Jan. 1st 1970, 00:00:00 GMT".
Return-Type: Number
Arguments: None.
Examples:
CurrentMillis
IsDate
IsDate(datetext, formatpattern [, localename | langcode, countrycode])
Function: Checks if the given format specifications can be used to correctly parse a numerical date/time value from the given "datetext" text argument. Returns "true" if a date/time value can be correctly parsed from the arguments, "false" if not.
This function is a companion function to ToMillis. If IsDate returns "true" for a given set of arguments, then it is safe to use ToMillis on the same set of arguments (i.e. ToMillis will not generate an error when used with the same arguments).
Please see Date and Time Patterns for details about how to write the format pattern.
Note: For formatting purposes, LISTSERV Maestro will by default use the U.S. locale and the time zone of the server where the LUI component is running. Therefore, locale specific texts, like weekday names, names of months, and so on, will be formatted using the U.S. locale. Similarly, times will be formatted using the server's time zone. If you want to specify a different locale, you can do so with the optional parameter "localename" to choose a predefined locale or with the optional parameters "langcode" and "countrycode" to specify your own locale. See Predefined Locales for details. If you want to specify the time as relative to a different time zone, you can include a time zone value in the date/time text.
Return-Type: Boolean
Arguments:
datetext - This argument can be of type Text, and its the date/time text string to parse. Must contain the desired date/time in a textual format that can be parsed by applying the given format pattern.
formatpattern - This argument can be of type Text, and it specifies the format pattern to use to parse the "datetext".
localename - This argument can be of type Text, and its the name of a predefined locale. If specified, any locale specific text in "datetext" will be expected according to this locale. This argument is optional. Either you supply no further argument at all or you only supply this argument.
langcode - This argument can be of type Text, and its a lowercase two-letter ISO-639 language code specifying the language for the locale. For example, see here http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt for one list of the ISO-639 language codes. This argument is optional. Either you supply no further argument at all or you supply both the following this argument and the next.
countrycode - This argument can be of type Text, and its an uppercase two-letter ISO-3166 country code specifying the country for the locale. For example, see here http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm for one list of the ISO-3316 country codes. If "langcode" and "countrycode" are specified, they are used to create a locale for the given language and country, and any locale specific text in "datetext" will be expected according to this locale.
Examples:
IsDate("February 22. 2004", "MMMM dd. yyyy")
(parses the given date using the default U.S. locale)
IsDate("Februar 22. 2004", "MMMM dd. yyyy", "Germany")
(parses the given date using the pre-defined locale for Germany)
IsDate("februari 22. 2004", "MMMM dd. yyyy", "de", "AT")
(parses the given date using a custom locale for language "de" =German and country "AT" =Austria)
SubscribeTimeMillis
SubscribeTimeMillis
Function: Returns the time when the subscriber has joined the dataset or subscribed to the hosted recipient list which is referenced by the target group in whose context the formula is used, represented in milliseconds since "Jan. 1st 1970, 00:00:00 GMT".
Restriction: Can only be used in formulas in the condition tree of a "Dataset" or "Hosted Recipient List" target group or in a *Calc system drop-in together with recipients based on such a target group. Will not be accepted in formulas for a different recipients type or in a formula of a derivation rule (of a derived profile field in a dataset or hosted list)!
Return-Type: Number
Arguments: None.
Examples:
SubscribeTimeMillis
ToDate
ToDate(datevalue, formatpattern [, localename | langcode, countrycode])
Function: Returns a formatted representation of a numerical date/time value. The formatted representation is usually returned as type Text, but may also be returned as type Number, if applicable. The format that is used to create the representation is specified with the given format argument.
Note: For formatting purposes, LISTSERV Maestro will, by default, use the U.S. locale and the time zone of the server where the LUI component is running. Therefore, locale specific texts, like weekday names, names of months, and so on, will be formatted using the U.S. locale. Similarly, times will be formatted using the server's time zone. If you want to specify a different locale, you can do so with the optional parameter "localename" to choose a predefined locale or with the optional parameters "langcode" and "countrycode" to specify your own locale. See Predefined Locales for details.
Return-Type: Usually Text. However, may be Number, if the result can be expressed as a number.
Arguments:
datevalue - This argument can be of type Number, and its the date/time value to format. Must contain the desired date/time represented as milliseconds since "Jan. 1st 1970, 00:00:00 GMT" (for example from the output of the functions CurrentMillis, SubscribeTimeMillis, and ToMillis).
formatpattern - This argument can be of type Text, and it specifies the format pattern to use to convert the milliseconds value in "datevalue" into the formatted representation.
localename - This argument can be of type Text, and its the name of a predefined locale. If specified, any locale specific text in "datetext" will be expected according to this locale. This argument is optional. Either you supply no further argument at all or you only supply this argument.
langcode - This argument can be of type Text, and its a lowercase two-letter ISO-639 language code specifying the language for the locale. For example, see here http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt for one list of the ISO-639 language codes. This argument is optional. Either you supply no further argument at all or you supply both the following this argument and the next.
countrycode - This argument can be of type Text, and its an uppercase two-letter ISO-3166 country code specifying the country for the locale. For example, see here http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm for one list of the ISO-3316 country codes. If "langcode" and "countrycode" are specified, they are used to create a locale for the given language and country, and any locale specific text in "datetext" will be expected according to this locale.
Examples:
ToDate(CurrentMillis, "MMM dd. yyyy")
(formats the current date using the default U.S. locale)
ToDate(CurrentMillis, "MMM dd. yyyy", "Germany")
(formats the current date using the pre-defined locale for Germany)
ToDate(CurrentMillis, "MMM dd. yyyy", "de", "AT")
(formats the current date using a custom locale for language "de" =German and country "AT" =Austria)
ToMillis
ToMillis(datetext, formatpattern [, localename | langcode, countrycode])
Function: Returns the numerical value representing the date/time as parsed from the "datetext" argument, where the numerical value specifies the date/time in milliseconds since "Jan. 1st 1970, 00:00:00 GMT" (which can, for example, then be compared to the output of the functions CurrentMillis and SubscribeTimeMillis, or be used as input to ToDate.
It generates a runtime error if there is a parse error. If you are unsure if a certain "datetext" and "formatpattern" can be parsed without an error, and you want to avoid this error, then use the companion function IsDate to first check if the arguments can be parsed at all, together with the function If (see the examples below.)
The format that is used to parse the given date/time text string is specified with the given format argument. Please see Date and Time Formats for details about how to write the format pattern.
Note: For formatting purposes, LISTSERV Maestro will by default use the U.S. locale and the time zone of the server where the LUI component is running. Therefore, locale specific texts, like weekday names, names of months, and so on, will be formatted using the U.S. locale. Similarly, times will be formatted using the server's time zone. If you want to specify a different locale, you can do so with the optional parameter "localename" to choose a predefined locale or with the optional parameters "langcode" and "countrycode" to specify your own locale. See Predefined Locales for details. If you want to specify the time as relative to a different time zone, you can include a time zone value in the date/time text.
Return-Type: Number
Arguments:
datetext - This argument can be of type Text, and its the date/time text string to parse. Must contain the desired date/time in a textual format that can be parsed by applying the given format pattern.
localename - This argument can be of type Text, and its the name of a predefined locale. If specified, any locale specific text in "datetext" will be expected according to this locale. This argument is optional. Either you supply no further argument at all or you only supply this argument.
langcode - This argument can be of type Text, and its a lowercase two-letter ISO-639 language code specifying the language for the locale. For example, see here http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt for one list of the ISO-639 language codes. This argument is optional. Either you supply no further argument at all or you supply both the following this argument and the next.
countrycode - This argument can be of type Text, and its an uppercase two-letter ISO-3166 country code specifying the country for the locale. For example, see here http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm for one list of the ISO-3316 country codes. If "langcode" and "countrycode" are specified, they are used to create a locale for the given language and country, and any locale specific text in "datetext" will be expected according to this locale.
Examples:
ToMillis("February 22. 2004", "MMMM dd. yyyy")
(parses the given date using the default U.S. locale)

ToMillis("Februar 22. 2004", "MMMM dd. yyyy", "Germany")
(parses the given date using the pre-defined locale for Germany)

ToMillis("februari 22. 2004", "MMMM dd. yyyy", "de", "AT")
(parses the given date using a custom locale for language "de" =German and country "AT" =Austria)

If(IsDate(&FIELD;, "MMMM dd. yyyy"), ToMillis(&FIELD;, "MMMM dd. yyyy"), 0)
(checks if FIELD contains a date that can be parsed with the given pattern and the default U.S. locale, and if so, returns the numerical representation of this date, otherwise returns the default "zero (0)".)
IsSupplied
IsSupplied(&MERGE_FIELD;)
Function: Checks if the merge field with the given name has a value or not. Returns "true" if the field has a value, "false" if not.
Return-Type: Boolean
Arguments:
&MERGE_FIELD; - (type irrelevant): This argument must be the name of a merge field (complete with the starting "&" and the closing ";"). It can not be a constant value (a number, text, boolean or set).
If this function is used in a *Calc system drop-in of a job with recipients of type "Upload a Recipient Text File" or "Select Recipients from a database" (or target group recipients that base on one of these types), then you can use any of the merge fields that exist in this job as an argument for the IsSupplied function. The function will then return "true", if the given merge field was empty either in the uploaded comma separated text file or in the corresponding database cell.
If however this function is used in a *Calc system drop-in of a job with target group recipients that are based on a dataset or a hosted recipients list, or if the function is used in the condition tree of such a target group, then you can not specify merge fields which are defined as "mandatory" or with the type "boolean", because such fields do by definition always have a supplied value. So using them with this function does not make sense, as the function would always return "true" for these fields anyway.
Examples:
IsSupplied(&FIELD_NAME;)
SecondaryValue
SecondaryValue(&MERGE_FIELD;, secondaryColumnName)
Function: This is an alternative method to retrieve the selected value of a single-select profile field, or the selected values of a multiple-select profile field. If such a profile field is included in the formula as a standard merge field (simply by supplying its merge field name &NAME;), then what you get is the currently selected entry name (for single-select) or a set of the currently selected entry names (for multiple-select). While this is usually the desired behavior, in special cases a different behavior may be required:
If the lookup table on which the profile field is based has secondary columns defined, then you might want to retrieve the matching secondary values instead.
This is what is done with this function: It retrieves the currently selected secondary value as a return value of type Text (for single-select), or the set of currently selected secondary values as a return value of type Text Set (for multiple-select) of the specified single/multiple-select profile field. From which secondary column the values are retrieved is specified with the secondaryColumnName argument.
Note: If this function is used to retrieve the secondary values of a multiple-select profile field, then the resulting set may have less elements than there are currently selected values for the profile field. This is because secondary values are not necessarily unique. So two or more of the selections of a certain subscriber could actually have the same secondary value. And since the return value of the function is a set (for multiple-select), and a set contains each element only once, those selections will result in only one entry in the resulting set.
Restriction: Can only be used in the derivation rule formula of a derived profile field, or in a formula in the condition tree of a "Dataset" or "Hosted Recipient List" target group, or in a "*Calc" system drop-in together with recipients based on such a target group. Will not be accepted in formulas for a different recipients type! Also, the specified profile field must be a single or multiple select field. Fields of other types will not be accepted. In addition, the specified secondaryColumnName must be the name of a secondary column that is defined in the lookup table on which the profile field is based.
Important: Please remember that the secondary column is referenced in this function by name only. So if you use this function in a formula anywhere, and then later edit the name of the secondary column in the lookup table definition (or delete the secondary column from the lookup table), then this will not automatically change the formula too. The effect will be, that the formula becomes invalid, as it now references a non-existent secondary column. This in turn could for example cause mail job delivery errors (if the function is used in a *Calc formula, or in a target group condition tree), or prevent the re-calculation of a derived profile field value (if the function is used in the derivation rule formula of a derived field).
Therefore, take care when renaming or deleting secondary lookup table columns and, if necessary, also edit/repair any formulas that make use of such columns.
Return-Type: Text or Text Set
Arguments:
&MERGE_FIELD; - (single or multiple select profile field): This argument must be the name of a merge field (complete with the starting "&" and the closing ";") that corresponds with a single/multiple select profile field in the dataset or hosted recipient list. It can not be a constant value (a number, text, boolean or set).
secondaryColumnName - This argument can be of type Text. It must specify the name of a secondary column in the lookup table that is associated with the specified &MERGE_FIELD;.
Examples:
SecondaryValue(&FIELD_NAME;, "Phone Number")
18.6 Date and Time Patterns
The format of the date and time patterns must be specified for the functions “ToDate” and “ToMillis” to convert a numerical date/time value (represented in milliseconds since “Jan. 1st 1970, 00:00:00 GMT”) into a formatted output string or vice versa.
The pattern format described here applies to the formatting process, when a numerical date/time value is converted into a formatted text string, and to the parsing process, when a text string is parsed to convert it back into the numerical date/time value.
Important: For date/time formatting and parsing, by default the U.S. locale and the current time zone of the server where the Maestro User Interface (LUI) component is running is used. This means that if locale specific values (names of months, weekdays, era-designators, and the like) are required, they will be given as the U.S. locale values by default. Similarly, if a time is given, it will be formatted (or interpreted) as relative to the time zone of the server (although for parsing a specific time zone can be supplied). If the default U.S. locale is not desired, specify a locale in the “ToDate” or “ToMillis” function.
18.6.1 Date and Time Formats
Date and time formats are specified by pattern strings. Within pattern strings, unquoted letters from ‘A’ to ‘Z’ and from ‘a’ to ‘z’ are interpreted as pattern letters representing the components of a date or time string (see below for details). Text can be quoted using single quotes <'> to avoid interpretation. In a quoted text, the “double” single quote <''> represents a single quote. All other characters are not interpreted; they are simply copied into the output string during formatting or matched against the input string during parsing.
The following pattern letters are defined (all other characters from ‘A’ to ‘Z’ and from ‘a’ to ‘z’ are reserved). The letters are case-sensitive. The same letter has different meanings in its uppercase or lowercase version. Each pattern letter has a specific “presentation” in the created final string (during formatting) or in the parsed string (during parsing). For example, presentation types may be Text, Number, Year or similar. More details about the presentations and their meanings follow below.
Commonly Used Pattern Letters
Special Pattern Letters
Notes: The value of “calendar week in year” and “calendar week in month” depends on the locale that is used. The locale determines the conventions about which weekday is interpreted as the first day of the week (usually “Monday” or “Sunday”) and under which circumstances a week that falls partially into one year (or month) and partially into the next, is interpreted as belonging to the one year (or month) or the other. The “weekday ordinal in month” indicates the ordinal number of the weekday of the given date/time in the given month. For the first Monday in a month, the ordinal is “1”, as it is for the first Tuesday, Wednesday and so on. For the second Monday in a month, the ordinal is “2”, and so on.
18.6.2 Presentation Description
Pattern letters are usually repeated, as their number determines the exact presentation:
Text: For formatting, if the number of pattern letters is four or more, the full form is used; otherwise, a short or abbreviated form is used if available.
For parsing, both forms are accepted, independent of the number of pattern letters.
Number: For formatting, the number of pattern letters is the minimum number of digits, and shorter numbers are zero-padded to this amount.
For parsing, the number of pattern letters is ignored unless it is needed to separate two adjacent fields.
Year: For formatting, if the number of pattern letters is two, the year is truncated to 2 digits; otherwise it is interpreted as a “Number” (see above).
For parsing, if the number of pattern letters is more than two, the year is interpreted literally, regardless of the number of digits. So using the pattern “MM/dd/yyyy”, the text “01/11/12” parses to Jan. 11, 12 AD.
For parsing with the abbreviated year pattern (“y” or “yy”), LISTSERV Maestro must interpret the abbreviated year relative to some century. It does this by adjusting dates to be within 80 years before and 20 years after the current time. For example, using the pattern “MM/dd/yy” on Jan. 1, 1997, the text “01/11/12” would be interpreted as Jan. 11, 2012, while the text “05/04/64” would be interpreted as May 4, 1964. During parsing, only strings consisting of exactly two digits will be parsed into the default century. Any other numeric string, such as a one digit string, a three or more digit string, or a two digit string that is not all digits (for example “-1”), is interpreted literally. Therefore, “01/02/3” or “01/02/003” are parsed, using the same pattern, as Jan. 2, 3 AD. Likewise, “01/02/-3” is parsed as Jan. 2, 4 BC.
Month: If the number of pattern letters is one or two, the month is interpreted as “Number”, if it is 3 or more, it is interpreted as “Text”. Therefore, if the month is interpreted as “Number” or “Text”, the applicable “Number”/ “Text” interpretation rules apply (see above). For example: 1 letter will be a “Number” that is not padded, 2 letters will be a “Number” that is padded, 3 letters will be a “Text” using the abbreviated form and 4 or more letters will be a “Text” using the long form.
General time zone: For formatting, the time zone is handled as “Text” if it has a name. If not, it is given as a GMT offset value in the format “GMT[+|-]HH:MM”, where “HH” is the hours between 0 and 23 (one or two digits, may be zero-padded to the left) and “MM” is the minutes between 00 and 59 (always two digits, zero-padded to the left if necessary). For example, “GMT+8:00”, “GMT+08:00”, “GMT-12:45”.
For parsing, see “Time zone parsing” below.
RFC 822 time zone: For formatting, the RFC 882 4-digit time zone format is used:
[+|-]HHMM”, where “HH” is the hours as two digits, between 00 and 23 (zero-padded to the left if necessary) and “MM” is the minutes as two digits, between 00 and 59 (zero-padded to the left if necessary).
For parsing, see “Time zone parsing” below.
Time zone parsing: For parsing of a time zone, it does not matter if the format pattern specifies a “General time zone” or a “RFC 822 time zone”: In both cases, all three types of time zone specifications are accepted:
Examples
The following examples show how date and time patterns are interpreted in the default U.S. locale with the “U.S. Pacific Time” time zone. The given date and time are “2001-07-04 12:08:56” local time in that time zone.
18.6.3 Predefined Locales
When specifying a locale to be used for date/time formatting in "ToDate" or for parsing in ToMillis, you can either specify the specific ISO codes of the desired country and language (see "ToDate" and "ToMillis”), or you can simply specify one of the following predefined locale names, which stands as a shortcut for the given language and country combination..
18.7 Quote-Escaping Rules
Any string literal in a formula is surrounded with double quotes like this:
"This is my string literal"
However, if the text itself is supposed to contain the quote character (") anywhere, special rules need to be obeyed. This is because if the quote was to be included just like that, LISTSERV Maestro would interpret it as the closing quote of the text and would try to interpret the rest of the text as part of the formula - which will almost always cause a syntax error, or at least give undesirable results.
Therefore, any quote character in the actual text must be escaped by "doubling" it. If you want to include a quote in the text, you must type two quotes, one right after the other, with no space between them ("").
During formula calculation, this "double-character" of two quotes will then be de-escaped back to a single appearance of the quote-character.
For example, if this is your string literal:
This is my "string" literal
Then the correctly quote-escaped and quote-enclosed version of this literal would be:
"This is my ""string"" literal"
Which would, when used in the formula calculation, once again appear like the un-escaped version:
This is my "string" literal