# \[IGN-2420\] Way to prevent script from running when popup view loads?

**URL:** <https://forum.inductiveautomation.com/t/ign-2420-way-to-prevent-script-from-running-when-popup-view-loads/61322>\
**Category:** General Discussion\
**Tags:** ignition81, scripting, perspective\
**Created:** [June 28, 2022, 8:22pm UTC](https://forum.inductiveautomation.com/t/ign-2420-way-to-prevent-script-from-running-when-popup-view-loads/61322 "2022-06-28T20:22:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rvaught](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rvaught](https://forum.inductiveautomation.com/u/rvaught)\
**Post date:** [June 28, 2022, 8:22pm UTC](https://forum.inductiveautomation.com/t/ign-2420-way-to-prevent-script-from-running-when-popup-view-loads/61322/1 "2022-06-28T20:22:25Z")

</div>

A View with a custom property, the property has a transform script, the transform script executes multiple times (3 times) each time the view loads.

Is there a way to block/prevent the script from running when the view initially loads?

Or a way to exit the script early until after the view is completely loaded?

---

<div class="post-metadata">

**Author:** ![rvaught](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rvaught](https://forum.inductiveautomation.com/u/rvaught)\
**Post date:** [June 29, 2022, 2:07pm UTC](https://forum.inductiveautomation.com/t/ign-2420-way-to-prevent-script-from-running-when-popup-view-loads/61322/2 "2022-06-29T14:07:21Z")

</div>

I don't think there is a direct way, through scripting, to know when the view is (first loading or starting) and is done evaluating tags / running transform scripts 

For now, I’m resorting to a bit of a hokey way to get around this by

1. Writing the date and time to a `property` on the view (in the view’s `onStartup` event)

2. In the transform script, compare `property` time to `datetime.datetime.now()` and **if (3) seconds have not passed then exit the script**.

If anyone knows of a cleaner/better way please let me know?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 29, 2022, 7:26pm UTC](https://forum.inductiveautomation.com/t/ign-2420-way-to-prevent-script-from-running-when-popup-view-loads/61322/3 "2022-06-29T19:26:36Z")

</div>

I don't really have an answer for you, however, this post might shed some light on what you're running into.

> [@Perspective components internal loading](https://forum.inductiveautomation.com/t/perspective-components-internal-loading/61341/4):
>
> There’s no way to know when the component is done, because in the strictest sense it’s not Ignition (Perspective) that’s taking the 10-20 seconds. The property assignment is instantaneous, but after the assignment there are several factors which all add to the amount of time: The Gateway has to send all of the data to the browser through the websocket. Like a pipe, there’s only so much data which can be sent at one time - the data sort of backs up and comes through in chunks. The browser recei…

I would also suggest using the `system.date.*` functions as opposed to the `datetime` package.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 29, 2022, 7:39pm UTC](https://forum.inductiveautomation.com/t/ign-2420-way-to-prevent-script-from-running-when-popup-view-loads/61322/4 "2022-06-29T19:39:14Z")

</div>

This is actually a different issue, most commonly encountered with expression bindings and/or chained bindings (`a > b > c > d`).

In these scenarios, any transform for `d` will evaluate as many times as there are links in the chain. This is because each of those properties initializes with an unknown value, then resolves its binding. That property now has a different value, and so any binding observing it will re-evaluate.

We do have a feature in-progress to reduce the thrash these sorts of bindings and transforms encounter, but modifying how bindings resolve is a very involved and delicate process, and there are also some other issues we need to resolve before we can reliably test it.

---

<div class="post-metadata">

**Author:** ![Gavin\_Tipker](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@Gavin\_Tipker](https://forum.inductiveautomation.com/u/Gavin_Tipker)\
**Post date:** [November 17, 2023, 7:19pm UTC](https://forum.inductiveautomation.com/t/ign-2420-way-to-prevent-script-from-running-when-popup-view-loads/61322/5 "2023-11-17T19:19:42Z")

</div>

Has this issue been addressed yet?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 17, 2023, 10:19pm UTC](https://forum.inductiveautomation.com/t/ign-2420-way-to-prevent-script-from-running-when-popup-view-loads/61322/6 "2023-11-17T22:19:04Z")

</div>

Yes. Binding dependencies are automatically calculated and fired in a deterministic order to _minimize_ extraneous firing since 8.1.21.
