Description:
This function LEN returns the number of characters in a text string.
Syntax: LEN (Text)
Remarks
Example
The LEN function can be used in any database where you have stored any text values and you want to count the number of characters in that text string. The function counts the number of characters in the text specified to the function as a parameter and then it returns the length of the text in numbers as the result of the function.
This function returns this number value as its result after the function computes the length of the parameter supplied to this function and after the function determines the number of characters within the text value specified.
=LEN ("Phoenix, AZ") |
-Length of the string (11) |
=LEN ("") |
-Length of the string (0) |
=LEN (" One ") |
-Length of the third string, which includes 5 spaces (8) |
Note: A number supplied within double quotes will be taken as a string parameter.
Let us take the example of a database in PowerOLAP where we have certain text values for name, last name, city, country etc., and we need to access these values and /or manipulate them and arrive at results with different permutations and combinations. We shall use this example in this case to calculate the number of in the text which is "Input" to this cube, in this instance it is "State" in the address for an individual. Here we have written a formula in the appropriate cube in PowerOLAP, pulling in the value from the above mentioned parameter and then calculating the length of the value which is the parameter supplied.
A number value is returned as the result for the LEN function.
The formula above writes values into the "StringDataFunctions" cube to the "String Data Manipulations" dimension into the member named "LEN" by calculating the appropriate value for this member, based upon the parameter that is given as input to this function namely the reference for the member "State". The result is returned calculating the Length of the text specified through the LEN function. The calculated length is the number returned by the function.