Forum Discussion
Marco
3 days agoContributor II
So what would you recommend I do to perform that operation in the DataBuffer? I want to calculate a percentage using those values, which is why I'm using a divide, but I haven't found an optimized way to do it.
rhankey
3 days agoContributor III
I would loop through the applicable entities, and either
- perform two GetDataCell()'s/entity, accumulating to a grand total Numerator & Denominator, or
- get a single filtered DataBuffer/entity, from which you could loop through to accumulate to the grand total Numerator & Denominator. This way is a few more lines of code, but reads only a single buffer from the cube/entity, and thus a bit more efficient.
The write back the division of the two grand totals.
Btw, using C#Local is risky. Better to use C#[EntityCurrency]. It's been too long since I used C#[EntityCurrency] to recall what C#Local returns if reading a Data Buffer for a different entity than is currently being computed. Also, if vertical extensibility is being used, and these entities are or could be in different cubes, you will need to specify the Cb# too.
Related Content
- 2 years ago
- 2 years ago
- 2 years ago
- 11 months ago