IF() TM1 TI Function: Use and Syntax

IF() is a function that can be used to test if an expression is true so that you can then differentially execute another function based on the outcome of the IF statement. It is able to be used in both Turbo Integrator processes and Rules, however, this post is about the use of it in TI’s only.  For Rule-based IF statements, please see this post.

Syntax of IF() for Turbo Integrator Processes

The syntax is a little bit complicated and looks like this:

If (expression1);
ElseIf (expression2);
ElseIf (expressionN);

So in this we are testing if expression1 is true and if so, then executing statement1.  If it is not true, then we are testing expression2 and if that is true, then executing statement2, and so on up to a maximum of 20 IF statements.

Note the placement of the EndIf; at the end.  This tells TM1 to stop analysing the expression and gives a point where the code should restart executing after an expression has been found to be true.

Use of IF() in TI Processes

An example of the use of IF is as follows:

If ( DIMIX ('Product',sProduct) = 0);

DimensionElementInsert ('Product,'',sProduct,'s');


This will test if the current contents of a variable called sProduct exist in the dimension ‘Product’ and if not, then inserting sProduct into that Product dimension.

This version of IF() is valid only in TurboIntegrator processes only.  Note there is also an IF() statement in Rules, however, the Rules IF() statement can only evaluate a single expression (with nesting available as well) and the TI IF() can do up to 20.

If you like this post, please spread the love…

About John

Managing Director of Infocube. We are a management accounting consultancy that specialises in Business Analytics.
This entry was posted in TI Functions and tagged DimensionElementInsert, IF. Bookmark the permalink.

8 Responses to "IF() TM1 TI Function: Use and Syntax"

Log in to post a comment.