Using data from previous row in calculation with loop

About a week or so prior to writing that post on Column Expressions, I was trying to find a “boilerplate” solution for cumulative calculations, and I built what I called the “cumulative framework”. This consists of a component which you handles all of the “previous row value” stuff on your behalf and hides all the functionality in further components.

As an academic exercise, to see how this “cumulative framework” would resolve your problem, it can be done like this:

What you do is download the Cumulative Framework component from here:

and follow the instructions on the component description.

You need to unlink the component, so that you can open and edit it.

You edit just the Rule Engine and Math Formula nodes. Executing the component up as far as the Rule Engine prior to editing, means that the component will supply simple to use columns for the previous row details like this:

The Column Expressions or Java Snippet equivalent solutions are probably the simplest way to resolve the problem, but for anybody not wanting to write the script, the Cumulative Framework provides a possible solution.

Cumulative Stock Calculation - using components 1.knwf (134 KB)