Functions
To manipulate values in grouping expressions, you can use the following functions:
Function | Return Data Type | Description | Example |
---|---|---|---|
DateAdd | Date | Returns a date value to which a time interval has been added, or from which a time interval has been subtracted. The function accepts the following arguments:
| Expression DateAdd("2016-10-20", 7, "d")adds 7 days to the specified date, and returns 2016-10-27. Nested expression SnapshotCreateTime < DateAdd (DateAdd(Today, -2, "d")) returns True if the latest VM snapshot was created earlier than 2 days and 12 hour ago. |
IndexOf | Numeric (integer) | Returns the position of the first occurrence of a specified value (substring) in a string. Index of the first character in a string is 0. Returns -1 if the value is not found within the string. The function accepts the following arguments:
| Expression IndexOf("vdi001_mrk", "_") returns 6. Expression IndexOf("vdi001", "_") returns -1. |
Left | Text (string) | Returns a substring that contains a specified number of characters from the left side of a string. The function accepts the following arguments:
| Expression Left("vdi001_mrk", 6) returns vdi001. Nested expression Left("vdi001_replica", IndexOf("vdi002_replica", "_")) returns vdi002. |
Length | Numeric (integer) | Returns the number of characters in a string. The function accepts a string value as an argument. | Expression Length("123456789") returns 9. For a VM, expression Length("Name") returns the number of characters in the VM name. |
Replace | Text (string) | Returns a string in which a specified substring has been replaced with another substring. The function accepts the following arguments:
Note: If the there are two or more equal substrings in a string, all substrings will be replaced. | Expression Replace("vdi002 mrk", " ", "_") changes the vdi002 mrk value to vdi002_mrk. For a VM, expression Replace(Name, "_replica", "") removes the _replica suffix from the VM name. |
Right | Text (string) | Returns a substring that contains a specified number of characters from the right side of a string. The function accepts the following arguments:
| Expression Right("vdi003_mrk", 3) returns mrk. Nested expression Right("vdi003_replica", (IndexOf("vdi003_replica", "_")) + 1) returns replica. |
Space | Text (string) | Returns a string that consists of the specified number of spaces. The function accepts a positive integer as an argument. | Nested expression Replace("vdi004_mrk", "_", Space(1)) changes the vdi004_mrk value to vdi004 mrk. |
Substring | Text (string) | Retrieves a substring from a specified string. The substring starts at the specified character position (index) and has the specified length. Index of the first character in a string is 0. The function accepts the following arguments:
| Expression Substring("vdi005_mrk", 7, 3) returns mrk. |
Trim | Text (string) | Returns a string with no leading or trailing spaces. The function accepts a string value as an argument. | Expression Trim(" vdi006 ") returns vdi006. |
TrimLeft | Text (string) | Returns a string with no leading spaces. The function accepts a string value as an argument. | Expression Trim(" vdi007") returns vdi007. |
TrimRight | Text (string) | Returns a string with no trailing spaces. The function accepts a string value as an argument. | Expression Trim("vdi008 ") returns vdi008. |
ToDate | Date | Converts a string containing a valid date representation to the DateTime format. Note: The function is based on the DateTime.TryParse function and accepts the same input values. | Expression ToDate("2009/03/12") returns 2009-03-12. Expression ToDate("ToDate(" 2009/03/01") returns 2009-03-01. |
ToLowerCase | Text (string) | Converts a string to lower case letters. The function accepts a string value as an argument. | Expression ToLowerCase("LoWeRCaSe") returns lowercase. |
ToUpperCase | Text (string) | Converts a string to upper case letters. The function accepts a string value as an argument. | Expression ToUpperCase("uppercase") returns UPPERCASE. |