Solved
Cumulative totals
How do you take a specific attribute from a grouped/sorted set of features, and cumulate the sum feature by feature and store in separate field?
Best answer by fmelizard
As far as I know, there is currently no single transformer that can acomplish this. As this requires saving some state between features, global variables get involved (unless you want to do some Python or Tcl scripting).
In the workspace at https://dl.dropbox.com/u/2275900/fmepedia/accumlate.fmw, I set up a small network of transformers that use a global variable named CumulativeCount to accumulate the values in the _creation_instance attribute for a series of features. For each feature, it performs the following sequence of operations:
1. Get the current value of CumulativeCount into the feature attribute _accumulated
2. Create the feature attribute _summed with a value of _accumulated + _creation_instance
3. Update the variable CumulativeCount with the value of _summed
4. Remove the temporary feature attribute _accumulated
This effectively keeps an accumulator in the global variable CumulativeCount, which it applies to the _summed attribute in every feature that passes through.
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

