Hi friends,
I need to do some calculation based on multiple condition. Please tell me how to check or use multiple condition in single If.
Thanks
How to check multiple condition using single if In TM1
- Martin Ryan
- Site Admin
- Posts: 2003
- Joined: Sat May 10, 2008 9:08 am
- OLAP Product: TM1
- Version: 10.1
- Excel Version: 2010
- Location: Wellington, New Zealand
- Contact:
Re: How to check multiple condition using single if In TM1
Do you mean in rules or in TI?
If in rules:
['left'] = N:
if(x=y, ['1'], if(z=q, ['2'], if(a=b, ['3'])));
If in TI:
if(a=b);
do something;
elseif(c=d);
do something else;
elseif(e=f);
something else;
else;
catch all other cases;
endif;
If in rules:
['left'] = N:
if(x=y, ['1'], if(z=q, ['2'], if(a=b, ['3'])));
If in TI:
if(a=b);
do something;
elseif(c=d);
do something else;
elseif(e=f);
something else;
else;
catch all other cases;
endif;
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
Jodi Ryan Family Lawyer
-
- MVP
- Posts: 352
- Joined: Wed May 14, 2008 1:37 pm
- OLAP Product: TM1
- Version: 2.5 to PA
- Excel Version: Lots
- Location: Sydney
- Contact:
Re: How to check multiple condition using single if In TM1
If you want to combine them into a single statement then & is AND, % is OR, ~ is NOT.
So in TI
in a rule
So in TI
Code: Select all
If( (a<5) & (b>10) );
do true stuff;
Else;
do false stuff;
EndIf;
Code: Select all
['Result'] = N:
If( (['Test 1'] > 0) % ~(['Test 2'] < 0) ),
['TrueValue'],
['FalseValue']);
Andy Key
-
- Posts: 11
- Joined: Tue Jun 14, 2011 4:17 am
- OLAP Product: Cognos TM1
- Version: 9.5
- Excel Version: 2010
Re: How to check multiple condition using single if In TM1
Hi,
Thanks for your answer,
I want to implement any one of OR, AND, NOT in if using TI process.
Thanks for your answer,
I want to implement any one of OR, AND, NOT in if using TI process.
-
- Posts: 11
- Joined: Tue Jun 14, 2011 4:17 am
- OLAP Product: Cognos TM1
- Version: 9.5
- Excel Version: 2010
Re: How to check multiple condition using single if In TM1
Hi,
Can i write in TI like
IF((var1=5) % ( var1=6) % (var1=7));
to check that value of var1 is 5 or 6 or 7(i.e. using OR condiotion)?
Thanks
Can i write in TI like
IF((var1=5) % ( var1=6) % (var1=7));
to check that value of var1 is 5 or 6 or 7(i.e. using OR condiotion)?
Thanks
-
- Site Admin
- Posts: 1458
- Joined: Wed May 28, 2008 9:09 am
Re: How to check multiple condition using single if In TM1
Yes.
Remember you need to use @= for strings.
Remember you need to use @= for strings.
-
- Posts: 11
- Joined: Tue Jun 14, 2011 4:17 am
- OLAP Product: Cognos TM1
- Version: 9.5
- Excel Version: 2010
Re: How to check multiple condition using single if In TM1
Thanks David:)