Calculating through a list

Hello all,

I need to calculate “through” a list of values starting with a given start value.
The input is a list with values and - of course - the start value.
The new value in a line is calculated as
startvalue + value(line 1) (if line = 1)
new value (previous line) + value (act. line) (if line > 1)

Additionally I have the restriction that the new value is limited by an upper and lower limit (e.g. [0…10]

Startvalue 3

line | value | new value
1    | 5     | 8 (3+5)
2    | 2     | 10 (8+2)
3    | 4     | 10 (capped by upper limit) 
4    | -1    | 9 (10+ (-1))
5    | -10   | 0 (capped by lower limit
6    | 5     | 5

I understand that the exists the Moving Aggregation – KNIME Hub
But I do not see how I could apply this to my challenge.

Hi @knimediger ,
this is the (correct version of) my tentative solution. Let me know if it helps

5 Likes

@duristef very nice solution. Thanks for sharing

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.