Error in rule

Post Reply
daya007
Posts: 49
Joined: Fri May 28, 2010 4:47 am
OLAP Product: TM1
Version: 9.5.1
Excel Version: 2003
Location: IL, USA

Error in rule

Post by daya007 »

Hi,

I have a measure in which one element is string(Current status) which contains a single alphabet('G', 'R', 'Y') and i have a simple element(Status). I want to populate the numeric field such as if string element has 'G' then 1, 'Y' then 2 and 'R' then 3.
I wrote a rule like this.
['Status']=IF(['Current Status']='G', 1, IF(['Current Status']='Y', 2, IF(['Current Status']='R', 3, 0)));

Am am getting following error

---------------------------
TM1 Error
---------------------------
Line 1: Syntax error on or before:
'G', 1, IF(['Current
incorrect logical comparison

Please help me with this error.

Thanks
Daya
Alan Kirk
Site Admin
Posts: 6667
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Error in rule

Post by Alan Kirk »

daya007 wrote:Hi,

I have a measure in which one element is string(Current status) which contains a single alphabet('G', 'R', 'Y') and i have a simple element(Status). I want to populate the numeric field such as if string element has 'G' then 1, 'Y' then 2 and 'R' then 3.
I wrote a rule like this.
['Status']=IF(['Current Status']='G', 1, IF(['Current Status']='Y', 2, IF(['Current Status']='R', 3, 0)));

Am am getting following error

---------------------------
TM1 Error
---------------------------
Line 1: Syntax error on or before:
'G', 1, IF(['Current
incorrect logical comparison

Please help me with this error.

Thanks
Daya
Use @=, not =, to do a comparison against a string value.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
daya007
Posts: 49
Joined: Fri May 28, 2010 4:47 am
OLAP Product: TM1
Version: 9.5.1
Excel Version: 2003
Location: IL, USA

Re: Error in rule

Post by daya007 »

Hi Alan

Thanks for the quick reply

I have tried

['Status']=IF(['Current Status']@='G', 1, IF(['Current Status']@='Y', 2, IF(['Current Status']@='R', 3, 0)));

still am getting following error.
Donno where i am missing.

---------------------------
TM1 Error
---------------------------
Line 1: Syntax error on or before:
['Current Status']@=
logical expression
Rule could not be attached to the cube, but changes were saved.
---------------------------
OK
---------------------------
tryinghard
Posts: 60
Joined: Wed Aug 04, 2010 3:59 pm
OLAP Product: TM1
Version: 9.5.1
Excel Version: 2007

Re: Error in rule

Post by tryinghard »

one thing to add that @and = should be together i.e. no space between them.
daya007
Posts: 49
Joined: Fri May 28, 2010 4:47 am
OLAP Product: TM1
Version: 9.5.1
Excel Version: 2003
Location: IL, USA

Re: Error in rule

Post by daya007 »

Yes they are together but same error :(
David Usherwood
Site Admin
Posts: 1458
Joined: Wed May 28, 2008 9:09 am

Re: Error in rule

Post by David Usherwood »

You're referencing string content using the [...] syntax, which won't work. Write full DB() references instead.
daya007
Posts: 49
Joined: Fri May 28, 2010 4:47 am
OLAP Product: TM1
Version: 9.5.1
Excel Version: 2003
Location: IL, USA

Re: Error in rule

Post by daya007 »

Thank you so much
it worked :D
Post Reply