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).
View original
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 a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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 a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.