# Loop over TimestepValues : NOT Updating

**URL:** https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495
**Category:** ParaView Support
**Tags:** python
**Created:** [June 27, 2021, 6:00am UTC](https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495 "2021-06-27T06:00:07Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Akash](https://discourse.paraview.org/user_avatar/discourse.paraview.org/akash/32/6994_2.png) [@Akash](https://discourse.paraview.org/u/Akash)
#### Post date: [June 27, 2021, 6:00am UTC](https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495/1 "2021-06-27T06:00:07Z")

</div>

Hey,  
I am trying to loop over my data with timestep. When I give values for n manually it works well. Here is the code:

```auto

n=34	
a3d10meshfinefoam.UpdatePipeline(a3d10meshfinefoam.TimestepValues[n])

```

But when I do the same thing with a loop (both FOR and WHILE) the timestep is not changing.Here is the code:

```auto
n=0
while(n<=48):

	a3d10meshfinefoam.UpdatePipeline(a3d10meshfinefoam.TimestepValues[n])
        ...
        ...
        ...
        n=n+1

```

I checked whether n is incrementing properly and it does but still, the time is not incrementing

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 27, 2021, 5:22pm UTC](https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495/2 "2021-06-27T17:22:18Z")

</div>

> [@Akash](#):
>
> the time is not incrementing

How do you check ?

---

<div class="post-metadata">

### Author: ![Akash](https://discourse.paraview.org/user_avatar/discourse.paraview.org/akash/32/6994_2.png) [@Akash](https://discourse.paraview.org/u/Akash)
#### Post date: [June 27, 2021, 6:12pm UTC](https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495/3 "2021-06-27T18:12:22Z")

</div>

While saving the data I named it as ‘Filename\_%d.csv’%n so the filenames were coming properly with different n values however all the files had the same data at timestep = 0. idk why

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 27, 2021, 8:20pm UTC](https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495/4 "2021-06-27T20:20:42Z")

</div>

please share your script

---

<div class="post-metadata">

### Author: ![Akash](https://discourse.paraview.org/user_avatar/discourse.paraview.org/akash/32/6994_2.png) [@Akash](https://discourse.paraview.org/u/Akash)
#### Post date: [June 27, 2021, 8:33pm UTC](https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495/5 "2021-06-27T20:33:55Z")

</div>

Here is the script:  
[script.txt](https://discourse.paraview.org/uploads/short-url/qnQEVDXjWwWG8mqV8MtRtCkvT4S.txt) (1.5 KB)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 28, 2021, 8:36am UTC](https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495/6 "2021-06-28T08:36:16Z")

</div>

You need to call UpdatePipeline(time) on the plot over line filter.

---

<div class="post-metadata">

### Author: ![Akash](https://discourse.paraview.org/user_avatar/discourse.paraview.org/akash/32/6994_2.png) [@Akash](https://discourse.paraview.org/u/Akash)
#### Post date: [June 28, 2021, 9:50am UTC](https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495/7 "2021-06-28T09:50:42Z")

</div>

Could you send the code line for that?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 28, 2021, 9:53am UTC](https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495/8 "2021-06-28T09:53:27Z")

</div>

not tested.

[script.txt](https://discourse.paraview.org/uploads/short-url/AhMs7JSpYml5q1QEcHccq0Ookcz.txt) (1.5 KB)

---

<div class="post-metadata">

### Author: ![Akash](https://discourse.paraview.org/user_avatar/discourse.paraview.org/akash/32/6994_2.png) [@Akash](https://discourse.paraview.org/u/Akash)
#### Post date: [June 28, 2021, 10:14am UTC](https://discourse.paraview.org/t/loop-over-timestepvalues-not-updating/7495/9 "2021-06-28T10:14:45Z")

</div>

It works. Initially it said “name ‘plotOverLine1’ is not defined” so i just defined it earlier before the loop and it works perfectly. Thanks a lot 😄
