ATTRS/N or DB}ElementAttributes for rule?

Post Reply
tosca1978
Posts: 101
Joined: Thu Oct 20, 2011 6:53 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2007
Location: London, UK

ATTRS/N or DB}ElementAttributes for rule?

Post by tosca1978 »

Hi all,

I was just wondering what the best practice is for referencing an attribute from within a rule. For example I could write the following 2 pieces of code within a rule to achieve the same result:

Code: Select all

ATTRS('Time_Day',!Time_Day,'Act For')@='Actual',
or

Code: Select all

DB('}ElementAttributes_Time_Day',!Time_Day,'Act For')@='Actual',
But I was wondering if either one performed better than the other or if there was a good reason to use one over the other. In worksheets I tend to use the DBRW approach into the }ElementAttributes cube rather than a DBRA formula if I'm copying the formula down a lot of rows becuase I think this performs better.

Cheers
User avatar
Alan Kirk
Site Admin
Posts: 6606
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: ATTRS/N or DB}ElementAttributes for rule?

Post by Alan Kirk »

tosca1978 wrote: I was just wondering what the best practice is for referencing an attribute from within a rule. For example I could write the following 2 pieces of code within a rule to achieve the same result:

Code: Select all

ATTRS('Time_Day',!Time_Day,'Act For')@='Actual',
or

Code: Select all

DB('}ElementAttributes_Time_Day',!Time_Day,'Act For')@='Actual',
But I was wondering if either one performed better than the other or if there was a good reason to use one over the other. In worksheets I tend to use the DBRW approach into the }ElementAttributes cube rather than a DBRA formula if I'm copying the formula down a lot of rows becuase I think this performs better.
Interesting question. I recall Andy Key stating that he had been told that a DBR worksheet function is faster than a DBRA, but whether the same is true of rules functions I couldn't say; it would be interesting to know if his informant provided some details on that. (Whether the difference would be material is another matter.)
"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.
User avatar
ioscat
Regular Participant
Posts: 209
Joined: Tue Jul 10, 2012 8:26 am
OLAP Product: Contributor
Version: 9.5.2 10.1.1 10.2
Excel Version: 07+10+13
Contact:

Re: ATTRS/N or DB}ElementAttributes for rule?

Post by ioscat »

don't really know if it is a good test:
1) created dim2 with 10^x elements

Code: Select all

vCount = 1;
vDimSize = 100000;
WHILE (vCount<vDimSize);
vCount_s = str(vCount, 10, 0);
dimensionelementinsert('dim2','', vCount_s,'n');
attrputs(vCount_s, 'dim2', vCount_s, 'test');
vCount = vCount + 1;
END;
cube1 rule

Code: Select all

skipcheck;

['a'] = N: NUMBR(ATTRS('dim2',!dim2,'test'))
+NUMBR(ATTRS('dim2',!dim2,'test'))
+NUMBR(ATTRS('dim2',!dim2,'test'))
+NUMBR(ATTRS('dim2',!dim2,'test'))
+NUMBR(ATTRS('dim2',!dim2,'test'))
+NUMBR(ATTRS('dim2',!dim2,'test'))
+NUMBR(ATTRS('dim2',!dim2,'test'));
cube2 -

Code: Select all

skipcheck;

['a']=N:NUMBR(DB('}ElementAttributes_dim2',!dim2,'test'))
+NUMBR(DB('}ElementAttributes_dim2',!dim2,'test'))
+NUMBR(DB('}ElementAttributes_dim2',!dim2,'test'))
+NUMBR(DB('}ElementAttributes_dim2',!dim2,'test'))
+NUMBR(DB('}ElementAttributes_dim2',!dim2,'test'))
+NUMBR(DB('}ElementAttributes_dim2',!dim2,'test'))
+NUMBR(DB('}ElementAttributes_dim2',!dim2,'test'));
didn't get any difference
Andy Key
MVP
Posts: 351
Joined: Wed May 14, 2008 1:37 pm
OLAP Product: TM1
Version: 2.5 to PA
Excel Version: Lots
Location: Sydney
Contact:

Re: ATTRS/N or DB}ElementAttributes for rule?

Post by Andy Key »

Alan Kirk wrote:Interesting question. I recall Andy Key stating that he had been told that a DBR worksheet function is faster than a DBRA, but whether the same is true of rules functions I couldn't say; it would be interesting to know if his informant provided some details on that. (Whether the difference would be material is another matter.)
Unfortunately not. We were only talking about worksheet functions.
Andy Key
Post Reply