# I want to show a progress bar while i'm running a loop but it does not update the window till the loop is done

**URL:** <https://forum.inductiveautomation.com/t/i-want-to-show-a-progress-bar-while-im-running-a-loop-but-it-does-not-update-the-window-till-the-loop-is-done/40704>\
**Category:** Ignition\
**Created:** [November 16, 2020, 7:23pm UTC](https://forum.inductiveautomation.com/t/i-want-to-show-a-progress-bar-while-im-running-a-loop-but-it-does-not-update-the-window-till-the-loop-is-done/40704 "2020-11-16T19:23:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.benson](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@michael.benson](https://forum.inductiveautomation.com/u/michael.benson)\
**Post date:** [November 16, 2020, 7:23pm UTC](https://forum.inductiveautomation.com/t/i-want-to-show-a-progress-bar-while-im-running-a-loop-but-it-does-not-update-the-window-till-the-loop-is-done/40704/1 "2020-11-16T19:23:17Z")

</div>

event.source.parent.getComponent(‘Progress Bar’).value = 0  
output = ‘’  
tags = system.tag.browseTagsSimple("", “ASC”)  
tagCount = 0  
doubleCount = 0  
headers = [“opc”,“name”, “fullname”,“doc”]  
data = []  
for tag in tags:  
event.source.parent.getComponent(‘Progress Bar’).value = event.source.parent.getComponent(‘Progress Bar’).value + 1  
if not tag.isFolder():  
opcAddress = system.tag.read(tag.fullPath + “.OPCItemPath”)  
opcDoc = system.tag.read(tag.fullPath + “.Documentation”)  
if len(opcAddress.value) \> 5:  
data.append([opcAddress.value,tag.name,tag.fullPath,opcDoc.value])

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 16, 2020, 7:24pm UTC](https://forum.inductiveautomation.com/t/i-want-to-show-a-progress-bar-while-im-running-a-loop-but-it-does-not-update-the-window-till-the-loop-is-done/40704/2 "2020-11-16T19:24:38Z")

</div>

Put three back ticks ` before and after your code to format it and indent it properly.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 16, 2020, 7:37pm UTC](https://forum.inductiveautomation.com/t/i-want-to-show-a-progress-bar-while-im-running-a-loop-but-it-does-not-update-the-window-till-the-loop-is-done/40704/3 "2020-11-16T19:37:19Z")

</div>

Either way, you need to have your script run asynchronously from the foreground.

> [@Update progress bar from within a script](http://forum.inductiveautomation.com/t/update-progress-bar-from-within-a-script/21995):
>
> I have this script on a button to copy data to a PLC from a database. Since this script takes 10 - 20 seconds to run, i would like to have the progress bar show progress. Issue I have is the progress bar updates only when the script has completed. Is there anyway to get value outside of the script to update as the script is running?

---

<div class="post-metadata">

**Author:** ![michael.benson](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@michael.benson](https://forum.inductiveautomation.com/u/michael.benson)\
**Post date:** [December 9, 2020, 1:17pm UTC](https://forum.inductiveautomation.com/t/i-want-to-show-a-progress-bar-while-im-running-a-loop-but-it-does-not-update-the-window-till-the-loop-is-done/40704/4 "2020-12-09T13:17:01Z")

</div>

That’s what I need

Thank you
