Page 1 of 1
Help with evaluating string
Posted: Sat Jun 30, 2012 10:59 pm
by mmckimson
I'm attempting to create a rule based upon string value, using the following formula which I have simplified to keep this discussion simple.
['FX Rate'] = N: IF('Customer Currency' @= 'EURO',0.5,0);
Here is a picture of the cube where the values are should appear:
When I perform a trace on the FX Rates, this is what I see:
When I trace the string value, it appears to be correct:
However, I tested the length of the string value in the cube and it came back as having a length of 20, so I'm stumped.
Any advice would be appreciated.
Mike
Re: Help with evaluating string
Posted: Sat Jun 30, 2012 11:08 pm
by declanr
mmckimson wrote:['FX Rate'] = N: IF('Customer Currency' @= 'EURO',0.5,0);
First things first - 'Customer Currency' is just the string/text 'customer currency'.
To pull a cell reference you either need to enclose within square brackets or a DB reference.
Edit - Should probably point you towards DB rather than Square Brackets when using strings.
Re: Help with evaluating string
Posted: Sun Jul 01, 2012 3:28 am
by mmckimson
declanr wrote:mmckimson wrote:['FX Rate'] = N: IF('Customer Currency' @= 'EURO',0.5,0);
First things first - 'Customer Currency' is just the string/text 'customer currency'.
To pull a cell reference you either need to enclose within square brackets or a DB reference.
Edit - Should probably point you towards DB rather than Square Brackets when using strings.
Declan,
That did the trick (using DB)... the question I would have is why does this work, and not a reference to the element only?
Mike
Re: Help with evaluating string
Posted: Sun Jul 01, 2012 8:06 am
by declanr
Mike,
What you had in your rule was simply evaluating whether the text 'customer currency' equalled 'euro' which it never will do because it is simply text and neither of them would change.
Had the 'Customer Currency' element been a numeric one you could have done ['Customer Currency']= 123 etc.
Strings you always have to evaluate fully using the DB reference.
If the questions is why do you have to use a DB ref instead of Square Brackets then you would have to go back and ask one of the guys that actually coded the thing but I suppose if you think about it when you use square brackets for numeric values; TM1 is running the DB in the background, the square brackets are just a nice visual created for us end users.
Declan