MicroStrategy ONE
RightStr (Right String Selection)
The RightStr
function returns a substring taken as a specified number of characters from the right of the input string. For example, the first eight characters from the right of the string "MicroStrategy" would be "Strategy".
RightStr
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, as in the credit card example below.
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.
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
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.