Token Functions
This feature lets you edit the token value with one or more pre-configured operations.
- Average: Determines the average of all the values in a multi-value token and replaces the token with the average. Non-numeric values will be ignored.
- Encode URI: Converts a token's characters (except RFC 2396 unreserved characters) to their hexadecimal representation so the token can be used in a web address. More info.
- Encode URL: Converts a token's characters (except RFC 3987 unreserved characters) to their hexadecimal representation so the token can be used in a web address. More info.
- Encode XML: Allows you to escape XML characters, such as <, >, ", ', and &, and replace them with their encoded values. Choose this option if your token includes XML characters that you want to display as text in e-mails or other places. If you do not encode the XML with this function, e-mail clients may try to interpret the XML instead of simply displaying the text.
- EscapeSearchName: Includes a backslash (\) in a query for fields and templates that contain an escape character.
Example: You want to perform a field search {[]:[FieldName] = "Value"}, where FieldName is [Brackets and "Quotes"]. This produces {[]:[[Brackets and “Quotes”]] = “Value”}, which returns a 9085 unrecognized character error, because the additional brackets and quotes are not removed. To remove (or escape) the brackets in the field name, add "EscapeSearchName". This looks like {[]:[%(FieldNameToken#@EscapeSearchName@#)] = "Value"}. This resolves to {[]:[\[Brackets and \"Quotes\"\]] = "Value"}.
- EscapeSearchPhrase: Includes a backslash (\) in a query for the search value or phrase that contains an escape character.
Example: You want to perform a field search {[]:[FieldName] = "Value"}, where Value is bl"ah. This produces {[]:[FieldName] = “bl”ah”}, which returns a 9085 unrecognized character error, because the additional quotes are not removed. To remove (or escape) the quotes in the value, add "EscapeSearchPhrase". This looks like {[]:[FieldName] = "%(Value#@EscapeSearchPhrase@#)"}. This resolves to {[]:[FieldName] = "bl\"ah"}.
- Max: Determines the largest value in a multi-value token and replaces the token with the largest value.
- Min: Determines the smallest value in a multi-value token and replaces the token with the smallest value.
- Remove Duplicates: Removes duplicate values from multi-value tokens.
- Remove Empty Items: Removes empty values from multi-value tokens.
- Sort Ascending: Organizes the values in a multi-value token from smallest to largest.
- Sort Descending: Organizes the values in a multi-value token from largest to smallest.
- Split: Divides a single-value token into a multi-value token. The single-value token is divided whenever a specified character or characters appear in the token. When you apply this function, a text box appears for you to specify the characters the token will be divided at. Alternatively, click the Token button (right arrow)
to use a token in your delimiter.
Show me what this looks like.
- Sum: Adds together all the values in a multi-value token and replaces the token with the sum.
- Text Length: Counts the number of characters in the token's value and replaces the token with this number.
- To Lower: Converts all letters in the token's value to lowercase.
- To Title Case: Capitalizes the first letter of each word in the token to uppercase. If a word in the token is all capital letters (like an acronym) it will not be affected by this function. If there is a capital letter in the middle of the word, it will convert that letter to lowercase (i.e., "helLo" will be converted to "Hello," and "O'Neil" will be converted to "O'neil.")
- To Upper: Converts all letters in the token's value to uppercase.
- Trim: Removes any white spaces before or after a token's value.
- Value Count: Counts the number of values in a multi-value token and replaces the token with this number.
Example: If you apply this function, http://My Website.com will be converted to http://My%20Website.com. You may want to use this function with tokens used in the HTTP Web Request and HTTP Form Post activities so the URLs resolve correctly.
Example: If you apply this function, ?parameter1=1&1parameter2=2 will be converted to %3Fparameter1%3D1%26parameter2%3D2. This activity will convert more characters than Encode URI
Example: If you apply this function, <tag> will display as <tag>;.
Example: If the token's value is "Jan;Bob;Sue" and you specify ";" as the delimiter, then the result of this function will be a token with three values: "Jan ", "Bob ", and "Sue ". If the token's value is Animal Control Department Health Department Human Resources Department Accounting Department, and you specify "Department" as the delimiter, the resulting multi-value token will have four values: "Animal Control ", " Health ", " Human Resources ", and " Accounting ".
Tip: The split function adds a blank space at the end of each value. Additionally, if the single-value token has spaces between the delimiter and the next value those spaces will be retained. Combine this function with the "Trim" function to remove those extra spaces from the multi-value token.
You can split a token into a multi-value token by entering one of the following control characters into Split on. When you apply the control character, the syntax is changed to %(Token 1#@Split(#NEWLINE#)@#), where this example uses the #NEWLINE# control character.
Character | Description |
---|---|
#CR# | Carriage return (for older mac style) |
#NL# | Newline/line feed (unix style) |
#LF# | Newline/line feed (unix style) |
#CRNL# | Carriage return and newline (windows style), order matters |
#CRLF# | Carriage return and line feed (windows style), order matters |
#NLCR# | Newline and carriage return (windows style), order matters |
#LFCR# | Line feed and carriage return (windows style), order matters |
#TAB# | Tab |
#NEWLINE# | Newline (windows style), newline/line feed (unix style), and carriage return (for the older mac style) |
#\r# | Carriage return (in C-style syntax) |
#\t# | Tab (in C-style syntax) |
#\n# | Newline (in C-style syntax) |
#\r\n# | Carriage return and new line (in C-style syntax), order matters |
#\n\r# | Newline and carriage return (in C-style syntax), order matters |
Example: Work Request forms require that employee's last names be no more than 10 letters. By applying the Token Length function to the %(Last Name) token, you can count how many letters are in the employee's last name. Using a Conditional Sequence activity (to check for Last Name tokens with a value larger than 10) and a Pattern Matching activity, you can truncate all employee last names that are longer than 10 letters.
Tip: If your token is in all capital letters and you want to convert it to title case, first apply the "To Lower" function and then the "To Title Case" function.
To apply a Token Function
Click the Select function link, and, in the Token Function dialog box, move the functions you want to apply to the token from the left Available column to the right Applied column by clicking the green right arrow
. Functions will be applied to the token in the order they appear in the right column. You can change the order by selecting the function you want to move and using the green up-and-down arrows
. Click OK to return to the Token Editor.