MicroStrategy ONE

Right String (string from the input's right)

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

Syntax

RightStr (Argument, Length)

Where:

  • Argument is a metric, fact, column, or string representing the text string(s).

  • Length is an integer indicating the number of characters to be returned.

Example

The RightStr function can be used to create attribute forms that display only part of the information available. This can be helpful when some information needs to be hidden for security purposes.

For example, an LU_CUSTOMER table includes a CREDIT_CARD_NUMBER column that contains credit card numbers for online customers. You create attribute forms to display only the last four digits of the customers' credit card numbers. The definition of such an attribute form is shown below:

RightStr([CREDIT_CARD_NUMBER], 4)

The integer value of 4 causes the RightStr function to only display the last four characters from the CREDIT_CARD_NUMBER column.

You could also combine this functionality with the Concat function to display Xs or other characters to represent the digits for the credit card that are not displayed.

Concat("XXXX-XXXX-XXXX-", RightStr([CREDIT_CARD_NUMBER], 4))

This definition would modify the display of a credit card number from 1111-2222-3333-4444 to be displayed as XXXX-XXXX-XXXX-4444.