LONG TM1 Function: Syntax and Use

The LONG function in TM1 returns the length of a string as a value.  It is similar to the LEN functions available in both Excel and SQL Server.

Syntax of LONG

The syntax is LONG(string); where string is either the literal string to be evaluated or a variable that contains the string to be evaluated.


An example of the use of it is as follows

sString = 'ExploringTM1';

LONG ( sString );

will return the numeric value 12. From here other numeric calculations can be performed on the output.

This function is sometimes used in combination with the SUBST function to select the right most set of characters from a string. Here you would get the length of a string, then subtract how many right end characters you want, then start the SUBST at that number plus 1 and then go for x characters. For example if you wanted the right 3 characters of exploringtm1, you would get the length of that, 12, subtract 3 to get 9, add one to get the starting point and then get the next three characters, i.e. at positions 10, 11 and 12.

LONG can be used in both Rules and Turbo Integrator processes in TM1 and Planning Analytics.

Posted in:


Leave a Comment

Need help with TM1?
We're here for you



Popular Articles