Page 1 of 1
ATTRS/N or DB}ElementAttributes for rule?
Posted: Thu Oct 11, 2012 7:21 am
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
Re: ATTRS/N or DB}ElementAttributes for rule?
Posted: Thu Oct 11, 2012 8:30 am
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.)
Re: ATTRS/N or DB}ElementAttributes for rule?
Posted: Fri Oct 12, 2012 11:20 am
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
Re: ATTRS/N or DB}ElementAttributes for rule?
Posted: Wed Oct 17, 2012 3:57 am
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.