MicroStrategy ONE

LeftStr (Left String Selection)

The LeftStr function returns a substring taken as a specified number of characters from the left of the input string. For example, if the specified length is five, LeftStr would return the string "Micro" from the original string "MicroStrategy". LeftStr is useful for abbreviations or length reduction when the entire input string is not required.

Syntax

LeftStr (Argument, Length)

Where:

  • Argument is a metric, fact, column, or string value representing the text string(s).
  • Length is an integer indicating the number of characters, starting from the far left position of the string, to be returned.

For information on the syntax used in your specific database, see MicroStrategy and Database Support for Functions and see the section that corresponds to your database.

Example

The LeftStr function can be used to create attribute forms that use abbreviations. This can help reduce the length for attribute forms that may have long descriptions.

For example, an LU_CUSTOMER table includes two columns: CUST_FIRST_NAME and CUST_LAST_NAME. You create attribute forms for the customer first and last names. You also create an attribute form that displays only the first letter of the first name. This attribute form can be used when the full first name does not need to be displayed. The definition of such an attribute form is shown below:

LeftStr([CUST_FIRST_NAME], 1)

The integer value of 1 causes the LeftStr function to only display the first character at the far left position for all inputs from the CUST_FIRST_NAME column.

For an additional example of using the LeftStr function, see the example section for the function InitCap (Initial Capitalization).