MicroStrategy ONE
Initial Cap
The InitCap function returns a string in which the first letter of the input string is capitalized; all other letters appear in lower case. This can help to fix capitalization errors for information that is displayed for attribute forms, metrics, and other objects.
Syntax
InitCap(Argument)
Where:
-
Argument is a metric, column, or string value representing the text string.
Example
The InitCap function can be used to fix capitalization errors for information that is displayed for attribute forms. For example, an LU_CUSTOMER table includes two columns: CUST_FIRST_NAME and CUST_LAST_NAME. To ensure that the first letter of the last name is capitalized you create an attribute form with the following definition.
InitCap([CUST_LAST_NAME])
The input from the column is modified so that the first character is capitalized and all other characters are lowercase. For example, if the column included information such as jackson, sMITh, and Hughes, these would be displayed as Jackson, Smith, and Hughes respectively.
Be aware that this function could potentially return undesired results in certain scenarios. Using the scenario described above, consider the name McCoy. Using the InitCap function, this would be displayed as Mccoy.
Another way to use this function would be to create an attribute form that combined the first letter of someone's first name with the person's full last name. The InitCap function could be used to ensure that the first letter of the first name was capitalized. An attribute form of this type would require the use of the functions InitCap, ConcatBlank, Concat, and LeftStr. The definition of such an attribute form is shown below:
ConcatBlank(Concat(LeftStr(InitCap([CUST_FIRST_NAME]), 1), "."), [CUST_LAST_NAME])
An attribute form using a definition such as the one listed above would display names such as J. Doe, M. Smith, and L. Martinez. The InitCap function ensures that the first letter of the first name is capitalized.