Page 1 of 1

Need help optimizing simple rule

Posted: Tue Aug 13, 2013 8:13 am
by Sighurd
Here is a simplified version of the problem I stumbled upon in Cognos Express 10.1, Architect.

I have a detailed cube which contains different values about Product Lines. Product lines are grouped to Product Types. This cube is in upper-left corner of a screenshot.

screenshot

I need to get the data into other cube which contains same data for Product Types. It is on the lower left corner of the screenshot.

I tried 3 approaches to write a rule, and I don't really like the result. They are on the right side of the screenshot. Only first approach really works, but in my real task there are a lot of Product Types and they are constantly changing, so supporting this approach will require a LOT of maintenance. I would be happy if approach #3 worked, but it does not.

I think I oversee something really simple, and i hope someone will point it out for me.

Re: Need help optimizing simple rule

Posted: Tue Aug 13, 2013 8:44 am
by Michel Zijlema
Hi,

You could use your 3rd rule - with one change: you need to use the !t reference instead of the !t-l reference as the !t-l dimension is not included in the t-values cube.

Michel

Re: Need help optimizing simple rule

Posted: Tue Aug 13, 2013 8:53 am
by Sighurd
It worked, thank you! :D

Now I need some time to actually understand why :shock:

Re: Need help optimizing simple rule

Posted: Tue Aug 13, 2013 6:56 pm
by tkingcka
Can you post a screen shot of the final rule with the recommended change? Thanks

Re: Need help optimizing simple rule

Posted: Wed Aug 14, 2013 2:30 am
by EvgenyT
Sighurd wrote:It worked, thank you! :D

Now I need some time to actually understand why :shock:
As Michel said ...
you need to use the !t reference instead of the !t-l reference as the !t-l dimension is not included in the t-values cube.
In simple words !t-l dimension is not part of the t-values cube, hence you are getting an error...

Re: Need help optimizing simple rule

Posted: Wed Aug 14, 2013 10:06 pm
by Sighurd
The final rule is:

Code: Select all

[]=DB('t-l-values',!t,!values_dim);
I read what Michel said and I have no doubts whatsoever that he is right. The only reason I am confused is that I got the wrong expression

Code: Select all

[]=DB('t-l-values',!t-l,!values_dim);
using standard wizard in expression editor. I selected the source cube t-l-values and had to replace one of it's dimensions in wizard's output manually. It is a little counterintuitive, so I had to dwell on that. I think I understand it now :)

Re: Need help optimizing simple rule

Posted: Wed Aug 14, 2013 11:03 pm
by EvgenyT
Hehe. Its a bit... when I first started writing rules I was puzzled too..

Simple rule: when referring other cubes in your rule ( DB('t-value..) etc ) you must use source dimension reference, even if the elements are the same in both dimension.

Does it make sense?

Thanks

ET

Re: Need help optimizing simple rule

Posted: Thu Aug 15, 2013 12:12 pm
by tomok
Here's a little bit more. When writing rules that use the !DimensionName syntax, the DimensionName parameter has to be a dimension that exists in the current cube. The rule syntax checker requires that. It doesn't mean that the actual dimension has to exist in the other cube for the rule to work. At run time, TM1 will use the elements in the existing cube to do a JOIN against the dimension in the source cube. The rule will work for any element names that match in the two dimensions, i.e., where the JOIN works. This is an EXTREMELY powerful feature and can be used to your advantage in many ways. I use it all the time.

Re: Need help optimizing simple rule

Posted: Thu Aug 15, 2013 3:23 pm
by Sighurd
Thank you, colleagues! Your input is very clear, precise and straight to the point. I am very glad I did post my question here!
I think I'll post another one :)