Loop and column

Hello team,

I would like to make certain math formula based on the value of another column.

For example:
if Column A value is 1, then math formula
if column A value is 2, restart from zero and do the sama math formula

Please let me know the best way to achieve this.

The easiest way is probably a Java snippet, if you know how to write java code.

maybe also define your problem in a more general way. To be it sounds like you want to do some aggregation or cumulative sum? Have a look at MovingAggregation node.

Hi there @SahandMalek,

welcome to kNIME Community!

What does it mean restart from zero? Giving example input data and desired output can help :wink:


Hello thank you for your help. Yes Moving aggregation works, but I need it for each bulk of data.

Let’s say there are n observations. I need moving aggregation for observation 1, then for observation 2, etc.

at the moment the moving aggregation adds everything regardless

Thank you for your kind message. Sure. here is how it would be in Exltest.xlsx (6.6 KB)

Hi @SahandMalek,
if I’m on the right way your Column C in your table contains the observation. But then your formula in Column D does not consider the observation change.

With Knime you should get the solution if you take your Moving aggregation Node between a Group Loop Start Node and a Loop end Node using your identifier and observation as group criteria.



@morpheus thank you for your support. Great help. Thanks.

1 Like

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