LeftTrim/RightTrim

LeftTrim and RightTrim allow you to trim text from the results of other text functions such as MemberAlias and MemberName based on a specified delimiter. These functions can be used in place of the left, right, and mid text functions, where the number of characters to trim may vary and there is a delimiter present in the text. For example,"-".

Syntax

LeftTrim (text, delimiter, start position, occurrence)

RightTrim (text, delimiter, start position, occurrence)

"text": Select the text function whose output the trim will be applied to.

"delimiter": The character (or string) used to split/parse the resulting text.

"occurrence" (optional): A number indicating which instance of the delimiter to use when parsing (e.g., 1 = first occurrence, 2 = second).

Examples

For a segment with Accounts where MemberAlias("Accounts") = "10000 - Net Income":

LeftTrim(MemberAlias("Accounts"), "-", 1) yields "10000"

RightTrim(MemberAlias("Accounts"), "-", 1) yields "Net Income"

For a segment with Accounts where MemberAlias("Accounts") = "10000 - Net Income - Summary", note the occurrence is set to 2:

LeftTrim(MemberAlias("Accounts"), -, 1, 2) yields "10000 – Net Income"

RightTrim(MemberAlias("Accounts"), "-", 1, 2) yields "Summary"