String transformation functions


While transforming mapped fields in a new or existing flow, you can use the string transformation functions. For more information, see Transforming-mapped-fields.

The following table explains the string transformation functions that are available in BMC Helix Integration Studio:

Function

Description

Example

substring / substring()

Returns a part of the source string identified by start and end parameters.

  • The minimum start value is 0 and corresponds to the first character in the string.
  • The end parameter is optional. If no value is provided, the part starting from start to the end of the string will be returned.

Note: The function processes the character in the start position, but not the one in the end position.

If the source string is "integer", applying substring(0,2) returns "in".

substr / substr()

Similar to substring(), except that you have start and length parameters.

  • The minimum start value is 0 and corresponds to the first character in the string.
  • The length parameter is optional; if no value is provided, the part starting from start to the end of the string will be returned.

If the source string is "Integration", applying substr(1,2) returns "nt".

words / words()

Returns the source string or a part of the source string as a collection of words. It has the following parameters: start, end, separator, and join.

  • The minimum start value is 0 and corresponds to the first character of the first word in the string.
  • The end parameter is optional; if no value is provided, all words starting from the start position to the end of the source string will be transformed.
  • The separator parameter is optional and is used to split the source string into separate words. A separator value can be any character, or any string enclosed between // (such as /my-separator/) . If no value is provided, the entire source string (from start to end) will be processed as one word.
  • The join parameter is optional and is used to concatenate words. The default value is ' ' (a single whitespace character).

Note: The function processes the character in the start position, but not the one in the end position.

If the source string is "hard!to!read!", applying words(5,11,!) returns "to read".

lines / lines()

Returns the source string or a part of the source string as a collection of lines. The implicit \n character is used to split lines.

  • The minimum start value is 0 and corresponds to the first character of the first line in the string.
  • The end parameter is optional; if no value is provided, all lines starting from the start position to the end of the source string will be transformed.

Note: The function includes the character in the start position, but not the one in the end position.


If the source string is:

"This is line 1.
This is line 2.
This is line 3."

Then applying lines(17) returns:

"This is line 2.
This is line 3."

replace / replace()

Returns the source string after replacing a matching value.

  • searchValue identifies the value that the source string will be parsed for.
  • newValue replaces all occurrences of searchValue.

If the source string is "myemail@email.com", then applying replace(@,[at]) returns "myemail[at]email.com".

toUpperCase / toUpperCase()

Converts and returns the source string in all uppercase letters. This function has no parameters. 

If the source string is "some text", applying toUppercase() returns "SOME TEXT".

toLowerCase / toLowerCase()

Converts and returns the source string in all lowercase letters. This function has no parameters.

If the source string is "SOME TEXT", applying toLowercase() returns "some text".

capitalize / capitalize()

Converts and returns the source string with the first letter in all words capitalized. This function has no parameters.

If the source string is "some text", applying capitalize() returns "Some Text".

stripHtml()

Removes the HTML tags used for text formatting to send plain text to a target system. Use this function if the HTML markup is not supported in a target application of your flow.

This function has no parameters.

If the source string is:

"This is a text from a JIRA comment:

  • some text 1
  • some text 2"

Then applying stripHtml() returns:

"This is a text from a JIRA comment: some text 1 some text 2".

isEqual(value) /

isNotEqual(value)

Sets the boolean fields in a target application to True or False. You must configure the parameters in one of the following ways:

  • Select isEqual and specify a value
  • Select isNotEqual and specify a value

Note: This function is available only for the boolean fields and is hidden for the other fields.

  • If you apply isEqual, and a value from a target application is equal to the specified value, the boolean field in a target application is set to True.

  • If you apply isEqual, and a value from a target application is not equal to the specified value, the boolean field in a target application is set to False.

  • If you apply isNotEqual, and a value from a target application is not equal to the specified value, the boolean field in a target application is set to True.

  • If you apply isNotEqual, and a value from a target application is equal to the specified value, the boolean field in a target application is set to False.

currentTime()

Sets the current time as a timestamp for the fields of the following data type:

  • Datetime
  • Date
  • Time
  • Integer

For the datetime, date, and time fields, the value is the appropriate string representation of the current time. For integer fields, the value is the number of seconds since January 1, 1970 (epoch date).

If the source time is "16:00:05", and the current time is "17:01:01", applying currentTime() returns "17:01:01".

formatDate(<format string>, [timezone])

Formats values to a specified string format for the fields of the following data type:

  • Datetime
  • Date
  • Time

Optionally, you can specify a timezone to convert a value according to the timezone before formatting the value into the string.

If the source date is "11/12/2019", applying formatDate(yyyy-mm-dd) returns "2019-12-11".

getValueAt(<index>)

Extracts a value from a string array at a specified index under the following conditions:

  • The index value for getting a value is 1-based.
  • If there is no value at the specified index (the index value is greater than the length), the returned value is set to undefined.
  • Negative and 0 indexes are not allowed.

If the source string array is "some text is written here", applying getValueAt(2) returns "text".

insertValueAt(<index>, <string>)

Inserts a value at the start, at the end, or at a specified index into a string array under the following conditions:

  • Inserting a value at index 0 adds the value at the start of an array.
  • Inserting a value at index -1 appends the value to the end of an array.
  • Inserting a value at other positive indexes inserts a value in the array at that point. If the index value is greater than the length, the value is appended at the end of the string array.
  • Negative indexes (other than -1) are not allowed.

If the source string array is "some text is written here", applying insertValueAt(-1,with high importance) returns "some text is written here with high importance".

updateDateTime(value)

Adds additional time, in minutes, to the DateTime value. You can add any positive or negative integer.

If the source time is "11/12/2019:16:00:05", applying updateDateTime(120) returns "11/12/2019:18:00:05".

where 120 mins is equal to 2 hours.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*