Page 1 of 1

Error in rule

Posted: Mon Aug 16, 2010 9:26 pm
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

Re: Error in rule

Posted: Mon Aug 16, 2010 9:27 pm
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.

Re: Error in rule

Posted: Mon Aug 16, 2010 9:34 pm
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
---------------------------

Re: Error in rule

Posted: Mon Aug 16, 2010 10:30 pm
by tryinghard
one thing to add that @and = should be together i.e. no space between them.

Re: Error in rule

Posted: Mon Aug 16, 2010 10:33 pm
by daya007
Yes they are together but same error :(

Re: Error in rule

Posted: Mon Aug 16, 2010 10:39 pm
by David Usherwood
You're referencing string content using the [...] syntax, which won't work. Write full DB() references instead.

Re: Error in rule

Posted: Tue Aug 17, 2010 12:02 am
by daya007
Thank you so much
it worked :D