Page 1 of 1
Conditional Formulas in TI Variables
Posted: Thu Jul 29, 2010 9:15 am
by mce
Hi,
Sorry for the simple question as I am new in TM1.
Can we use conditional formulas in defining variables with formula in TI? If yes, what is the syntax, as I could not find it in the documentation.
Can we use other functions in such formulas and where can I find the syntax for those?
Thanks in advance.
Regards,
Re: Conditional Formulas in TI Variables
Posted: Thu Jul 29, 2010 9:38 am
by Jeroen Eynikel
Simple question, simple answer.
Yes you can use conditional functions (and a whole range of other functions in TI). Most of the functions you use in rules will also work in TI.
I would recommend you to take a look at the rules / ti functions in the reference guide (which you can access from the help menu). (the conditional function is obviously the IF function btw

)
Re: Conditional Formulas in TI Variables
Posted: Thu Jul 29, 2010 10:25 am
by mce
I now realized that there is a different syntax for the functions (IF) in TI than the ones in Rules.
Thanks.
Re: Conditional Formulas in TI Variables
Posted: Thu Jul 29, 2010 4:53 pm
by rkaif
Within the Rules use the following syntax:
Code: Select all
IF(expression, true_value, false_value)
For TI Process use the following syntax:
Code: Select all
If(expression);
statement1;
Endif;
You can also use multiple IF at a time and the syntax will be:
Code: Select all
If(expression);
statement1;
ElseIf(expression);
statement2;
ElseIf(expression);
statement3;
EndIf;
Re: Conditional Formulas in TI Variables
Posted: Thu Jul 29, 2010 10:21 pm
by Martin Ryan
It's possible to use the Rule sytax in TI too. E.g.
# This will assign the value 'One' or 'Two' to the variable v1, depending on the outcome of the condition
v1=if(v2<>v3, 'One', 'Two');
or
# This will either skip the current line, or continue processing it, depending on the outcome of the condition.
if(v2<>v3, ItemSkip, 0);
Obviously the TI version of "if" provides more flexibility (and arguably readability), but the rule way can mean less lines of code.
Martin