# how to update value between row iterations

**URL:** <https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546>\
**Category:** KNIME Analytics Platform\
**Created:** [July 28, 2022, 4:32pm UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546 "2022-07-28T16:32:49Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lama12345](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/l/f19dbf/32.png) [@lama12345](https://forum.knime.com/u/lama12345)\
**Post date:** [July 28, 2022, 4:32pm UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/1 "2022-07-28T16:32:49Z")

</div>

![Capture](https://forum-cdn.knime.com/uploads/default/original/3X/a/2/a29ed28a8d6de884bc59d571a30519bbea422e7c.png)  
Basically this is what I want to do. Anything highlighted in yellow is what I want to compute through knime and anything else is input data. Im having trouble updating the data of row 2 using the data computed in row 1 as shown in the figure  
any ideas?

---

<div class="post-metadata">

**Author:** ![gonhaddock](https://forum-cdn.knime.com/user_avatar/forum.knime.com/gonhaddock/32/35425_2.png) [@gonhaddock](https://forum.knime.com/u/gonhaddock)\
**Post date:** [July 29, 2022, 7:55am UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/2 "2022-07-29T07:55:45Z")

</div>

Hello @lama12345  
I think this is a job for ‘Recursive Loop’ nodes set 🤔

> [@Time Series Forecasting with differenced series](https://forum.knime.com/t/time-series-forecasting-with-differenced-series/42152):
>
> Hello, how can I get the original values back from a forecasted differenced time series? The picture below shows my original series (Original GDP), the lagged column and finally the differenced column. I used the differenced column to forecast 2001 - 2003. The results from the forecast are shown in column E. To get the original values I used the last available original value (2000Q4) plus the forecast. But afterwards I need the “Forecasted Original” previous value to calculate the next original…

unless @Daniel_Weikert hides a trick in his hat

BR

---

<div class="post-metadata">

**Author:** ![armingrudd](https://forum-cdn.knime.com/user_avatar/forum.knime.com/armingrudd/32/84633_2.png) [@armingrudd](https://forum.knime.com/u/armingrudd)\
**Post date:** [July 29, 2022, 10:39am UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/3 "2022-07-29T10:39:47Z")

</div>

Hi again @lama12345,

This is an example workflow for you to achieve what you have explained here:  
[45546.knwf](https://forum.knime.com/uploads/short-url/gVpJcBoJV4uPkXgThi0iE2oATry.knwf) (17.6 KB)

> [@gonhaddock](#):
>
> I think this is a job for ‘Recursive Loop’ nodes set

You can do this by modifying a single variable in each iteration of a chunk loop.

🙂

---

<div class="post-metadata">

**Author:** ![gonhaddock](https://forum-cdn.knime.com/user_avatar/forum.knime.com/gonhaddock/32/35425_2.png) [@gonhaddock](https://forum.knime.com/u/gonhaddock)\
**Post date:** [July 29, 2022, 11:13am UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/4 "2022-07-29T11:13:51Z")

</div>

@armingrudd  
awesome 🎩

---

<div class="post-metadata">

**Author:** ![Daniel\_Weikert](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@Daniel\_Weikert](https://forum.knime.com/u/Daniel_Weikert)\
**Post date:** [July 29, 2022, 4:43pm UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/5 "2022-07-29T16:43:04Z")

</div>

The end result is only the last column right? If so you can do it without a loop

(sorry @armingrudd I borrowed your workflow)

 ![save](https://forum-cdn.knime.com/uploads/default/original/3X/3/6/368883f1472c270de6104f8964b4d62e3ee33163.png)

---

<div class="post-metadata">

**Author:** ![armingrudd](https://forum-cdn.knime.com/user_avatar/forum.knime.com/armingrudd/32/84633_2.png) [@armingrudd](https://forum.knime.com/u/armingrudd)\
**Post date:** [July 30, 2022, 12:22am UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/6 "2022-07-30T00:22:30Z")

</div>

Not a problem at all @Daniel_Weikert.  
You are right, actually no loop is needed and to complete column1, the Lag Column node can be used at the end.  
I suggested the nodes to @lama12345 in the first topic but created the workflow with a chunk loop to demonstrate probagating variables in the loop.

> [@How to update a value between row iterations](https://forum.knime.com/t/how-to-update-a-value-between-row-iterations/45538/4):
>
> Ah, I think I’ve got it now. Sorry for misunderstanding you earlier. So what you need is a cumulative sum on column 2, right? That’s what you will find in this node: So you check the cumulative computation and do “sum” on column2.

---

<div class="post-metadata">

**Author:** ![lama12345](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/l/f19dbf/32.png) [@lama12345](https://forum.knime.com/u/lama12345)\
**Post date:** [July 31, 2022, 9:29pm UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/7 "2022-07-31T21:29:27Z")

</div>

@Daniel_Weikert hello! thanks for your reply, But can u explain further as im not really sure what you’ve done there

---

<div class="post-metadata">

**Author:** ![Daniel\_Weikert](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@Daniel\_Weikert](https://forum.knime.com/u/Daniel_Weikert)\
**Post date:** [August 1, 2022, 4:35pm UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/8 "2022-08-01T16:35:44Z")

</div>

I use rule egine to get only th 1 from column 1 while leaving all the follow rows empty, then I add the 3 from column to to have a starting value. I use the second rule engine to get the other columns from coluimn 2 in the same column as I have created (So I get 4,4,5,4). Then I do a cumulative computation  
br

---

<div class="post-metadata">

**Author:** ![lama12345](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/l/f19dbf/32.png) [@lama12345](https://forum.knime.com/u/lama12345)\
**Post date:** [August 1, 2022, 6:34pm UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/9 "2022-08-01T18:34:45Z")

</div>

@Daniel_Weikert can u show me a screenshot of the configuration of the rule engine nodes

---

<div class="post-metadata">

**Author:** ![lama12345](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/l/f19dbf/32.png) [@lama12345](https://forum.knime.com/u/lama12345)\
**Post date:** [August 1, 2022, 6:36pm UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/10 "2022-08-01T18:36:52Z")

</div>

and the other nodes if its not too much to ask 😅

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [August 9, 2022, 2:01pm UTC](https://forum.knime.com/t/how-to-update-value-between-row-iterations/45546/11 "2022-08-09T14:01:45Z")

</div>

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