What's the right way to calculate derived data in a Flex AdvancedDataGrid using summaries?

Posted by Chris R on Stack Overflow See other posts from Stack Overflow or by Chris R
Published on 2010-06-08T21:09:28Z Indexed on 2010/06/08 21:12 UTC
Read the original article Hit count: 409

Filed under:
|
|

Here's the gist of the problem:

I have a set of rows of data with (say) field1 to field4 in them. I'm using a GroupingCollection to group on field1 and field2. So, I have something like this:

f1.1
  f2.1
    f3.1    f4.1
    f3.2    f4.2
  f2.2
    f3.3    f4.3
    f3.4    f4.4
    f3.5    f4.5
f1.2
  f2.1
    f3.6    f4.6
  f2.2
    f3.7    f4.7
    f3.8    f4.8
    f3.9    f4.9

(or at least, I hope that's clear enough)

I need to calculate some derived values for each leaf row, for example f3, that is the ratio of f3 to the average of all f3 in that particular part of the tree. So, for f3.7 I need to calculate f3.7 / avg(f3.7..f3.9) and fill that into the f3_index property on the row, displaying that in lieu of f3 itself.

So, basically, what it looks like I have to do is add source field values in the summarizeFunction implementation. It seems to me that there must be a better way of doing this. Is there?

© Stack Overflow or respective owner

Related posts about flex

Related posts about flex3