# While loop script is not working

**URL:** <https://forum.inductiveautomation.com/t/while-loop-script-is-not-working/53390>\
**Category:** Ignition\
**Tags:** ignition81, scripting, perspective\
**Created:** [November 23, 2021, 3:50pm UTC](https://forum.inductiveautomation.com/t/while-loop-script-is-not-working/53390 "2021-11-23T15:50:44Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![IA\_old\_forum](https://avatars.discourse-cdn.com/v4/letter/i/7ab992/32.png) [@IA\_old\_forum](https://forum.inductiveautomation.com/u/IA_old_forum)\
**Post date:** [November 24, 2021, 11:51am UTC](https://forum.inductiveautomation.com/t/while-loop-script-is-not-working/53390/8 "2021-11-24T11:51:24Z")

</div>

Thank you everyone for the expeditious help! I realize it is not a good method... but I figured (before, in my head) it was the easiest to implement. There are 5 lines that make up one production machine. Each one of the five lines has about 17 tags (with machine signals) attached to them.

My main goal is to show the aggregate error outputs for the 5 lines in 1 hour (continuous) intervals. I have as shown in the second image of the post, 24 labels for "scrap" in this case. I didn't want to create 24 tags x 2 (scrap and good parts) + (possibly other tags ). I thought I could just use the labels directly as temporary "memory cells" for the counters

Maybe on my previous post, I explain a bi more in detail what I wanted to do:

> [@Hourly aggregates Historian/Transaction group/script](https://forum.inductiveautomation.com/t/hourly-aggregates-historian-transaction-group-script/53278):
>
> Hello everyone! I am trying to aggregate the number of errors for 1 hour intervals in the following way: under detailing (in the above image) I would like to show in the respective perspective label (the gray boxes next to scrap and good parts) the amount of errors/triggers for that particular hour. For example, if "error 1" Tag turned true 9 times and "error 2" Tag 6 times from 6-7 am, I would like to show (and maintain) the value of error aggregation and so on for every hour. I trie…

---

_[View the full topic](https://forum.inductiveautomation.com/t/while-loop-script-is-not-working/53390)._
