Basic transform editor functions
The TrueSight Orchestration Development Studio Basic transform editor provides the functions described in this page.
Basic transform editor functions
Function | Operands | Description |
|---|---|---|
String |
|
|
Substring | Start Index, length | Retrieves the substring of text that you specify. |
Substring Before | Text | Retrieves the substring that is displayed before the specified text. |
Substring After | Text | Retrieves the provided substring that is displayed after the specified text. |
Length | n/a | Retrieves the length of the string. |
Trim spaces | n/a | Trims leading and trailing spaces in the string, and replaces multiple spaces with a single space. |
Lowercase All | n/a | Converts the string to lowercase. |
Uppercase All | n/a | Converts the string to uppercase. |
Replace | Replace, with | Replaces the specified text with the provided text. |
Convert to Numeric | n/a | Converts the XML or text to a numeric value. It removes letters, commas, or other delimiters (except relevant decimal points). This function checks whether the digits after the decimal point are relevant before it decides whether to preserve or remove them. The function fails if the first character in the text to be parsed is a not a number or a decimal point followed by a number. See Convert to Numericfor examples. |
XML |
|
|
First Child | n/a | Retrieves the first child from the root. |
Last Child | n/a | Retrieves the last child from the root. |
Child at number | Child Index | Retrieves the child element at the specified position. |
XML to Text (newlines) | n/a | Extracts the text from all XML elements in the input. The text from each element is on a separate line. |
XML to Text | n/a | Extracts the text from all XML elements in the input. The text is concatenated into one string. |
Items contents contain | contains | Extracts items whose text contains the specified value. |
Element name contains | contains | Retrieves elements whose name contains the specified value. |
Element name matches | Node Name | Retrieves elements whose name exactly matches the specified value. |
Element attribute contains | attribute, value | Retrieves elements with a specific attribute that contains the specified value. |
Element attribute range | attribute, range | Retrieves elements, including sub-elements, that have a specific attribute whose value is contained within the specified numeric range. |
Remove elements whose attribute matches | attribute, value | Removes items from XML with a specific attribute matching the specified value. |
Remove elements whose attribute contains | attribute, value | Removes elements, including sub-elements, that have a specific attribute whose value is contained within a specified numeric range. The first operand defines the name, and the second operand defines the range. |
Remove elements in attribute range | attribute, range | Removes elements, including sub-elements, that have a specific attribute whose value is contained within the specified numeric range. |
Logical |
| These functions are self-explanatory. |
Less Than | Value |
|
Less than or equal To | Value |
|
Greater than | Value |
|
Greater than or equal To | Value |
|
Is True | n/a |
|
Is False | n/a |
|
Equal To String | String |
|
Equal to Number | Number |
|
Not Equal to String | String |
|
Not Equal to Number | Number |
|
Math |
| These functions are self-explanatory. |
Add | number |
|
Subtract | number |
|
Multiply | number |
|
Divide | number |
|
Modulo | integer |
|
Date and Time |
| These functions are self-explanatory. |
Get From Date | Day, Month (Number), Month (Abbr), Month (Full), Year (Short), Year (Long), Hours, Minutes, Seconds, AM/PM |
|
ISO Date (format) | Year, Year and Month, Date/Time (to min), Date/Time (to sec), Date/Time (exact) |
|
ISO Date (parse) | Year, Year and Month, Date/Time (to min), Date/Time (to sec), Date/Time (exact) |
|
US Date (format) | Date/Time (to min), Date/Time (to sec), Date/Time (exact) |
|
US Date (parse) | Date/Time (to min), Date/Time (to sec), Date/Time (exact) |
|
EU Date (format) | Date/Time (to min), Date/Time (to sec), Date/Time (exact) |
|
EU Date (parse) | Date/Time (to min), Date/Time (to sec), Date/Time (exact) |
|
Date Formatter | Date to String, String to Date | Uses the Java class SimpleDateFormat to convert dates to strings or strings to dates. |
Convert to Numeric
The following examples show how Convert to Numeric transforms input.
Test Value | Preview result | Notes |
|---|---|---|
126 | 126 |
|
126.0 | 126 | The decimal point and zero that follow it are irrelevant and removed. |
126.1 | 126.1 |
|
126.0000 | 126 |
|
126.00001 | 126.00001 |
|
1,126 | 1126 |
|
126.1.2 | 126.1 | The second decimal point and the character after it are ignored, because they are interpreted as not being part of the valid number. |
126a | 126 | The letter is irrelevant and removed. |
12a6 | 12 |
|
a126 | Returns an error that the generated transform is invalid. |
|
Math functions and decimals
The results of math functions include a decimal, as shown in the following examples. You can use the Convert to Numeric function to remove these decimals.
You can enter these example values into the Basic transform editor to test transforming data and see the results in the Preview area.
Math function example | Test Value | Function | Operand | Preview result |
|---|---|---|---|---|
Modulo | 457 | Modulo | 2 | 1.0 |
Add | 457 | Add | 3 | 460.0 |
Date Formatter codes
Use these codes with the Date Formatter function to define the date and time format.
Letter | Date or time component | Examples |
|---|---|---|
G | Era designator | AD |
y | Year | 1996; 96 |
M | Month in year | July; Jul; 07 |
w | Week in year | 27 |
W | Week in month | 2 |
D | Day in year | 189 |
d | Day in month | 10 |
F | Day of week in month | 2 |
E | Day in week | Tuesday; Tue |
a | AM/PM marker | PM |
H | Hour in day (0-23) | 0 |
k | Hour in day (1-24) | 24 |
K | Hour in AM/PM (0-11) | 0 |
h | Hour in AM/PM (1-12) | 12 |
m | Minute in hour | 30 |
s | Second in minute | 55 |
S | Millisecond | 978 |
z | Time zone (general) | Pacific Standard Time; PST; GMT-08:00 |
Z | Time zone (RFC 822) | -0800 |
The following examples provide Date Formatter operands and codes that you can enter into the Basic transform editor to test transforming data and see the results in the Preview area.
Date Formatter example | Test Value | Function | Operand | Operand (Date and Time Codes) | Preview result |
|---|---|---|---|---|---|
Convert a date string to an epoch timestamp example | <value>Jun 13 2003 23:11:52.454 UTC</value> | Date Formatter | String to Date | MMM dd yyyy HH:mm:ss.SSS zzz | 1055545912454 |
Convert an epoch timestamp to a date string example | <value>1055545912454</value> | Date Formatter | Date to String | MMM dd yyyy HH:mm:ss.SSS zzz | Jun 13 2003 23:11:52.454 UTC |