MicroStrategy ONE

Left String (string from the input's left)

The LeftStr function returns a substring taken as a specified number of characters from the left of the input string. In other words, you can define to take the first five characters, starting from the far left position of the string, from the string "MicroStrategy". This would display the string "Micro".

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.

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, refer to the example section for the function Initial Cap.