# Ignition Script Creates Duplicate Messageboxes

**URL:** <https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [January 25, 2024, 5:45am UTC](https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753 "2024-01-25T05:45:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Dahabrah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrew_dahabrah/32/56284_2.png) [@Andrew\_Dahabrah](https://forum.inductiveautomation.com/u/Andrew_Dahabrah)\
**Post date:** [January 25, 2024, 5:45am UTC](https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753/1 "2024-01-25T05:45:26Z")

</div>

So I created a project that is a searchable Photoeye status screen. You type in an asset number and it will give you live feedback of how the photoeye is doing. I want a messagebox to pop up if the user types in the wrong asset number.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/a/5aee1f6deb98b25365e0f37b961d2fc55fbcfdf9.png)

This is how I did it and it works great except for the fact that I get two messageboxes whenever the dataquality goes to zero. How do I fix this?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 5:58am UTC](https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753/2 "2024-01-25T05:58:56Z")

</div>

What's happening is that the dataQuality property is being checked for every property that changes in your component, instead of only being checked once when the dataQuality property changes.

To fix it, change your qualifier to this:

```auto
if event.propertyName == 'dataQuality' and event.newValue == 0:

```

---

<div class="post-metadata">

**Author:** ![Andrew\_Dahabrah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrew_dahabrah/32/56284_2.png) [@Andrew\_Dahabrah](https://forum.inductiveautomation.com/u/Andrew_Dahabrah)\
**Post date:** [January 25, 2024, 6:27am UTC](https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753/3 "2024-01-25T06:27:01Z")

</div>

Now the messagebox won't show up at all.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 6:52am UTC](https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753/4 "2024-01-25T06:52:07Z")

</div>

Hmmm. What I normally do in this situation is open up a diagnostic console to take a look under the hood.

Change your propertyChange script to this:

```auto
print event.propertyName, event.newValue

```

Make sure there is not a typo in your propertyName, and make sure that the datatype of your value is correct.

For example, if it's an integer, it should be:

```auto
event.newValue == 0

```

If it's a bool:

```auto
event.newValue == False

```

If it's a string:

```auto
event.newValue == '0'

```

etc...

In case you or some future reader doesn't know, the diagnostic console is accessed in this way:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/f/3f8dbc925ff1baaafc829c218b88fc3274145320.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/a/dad5efde48ce7340b948f69cdc2cd3862804af5a.png)

The data from the print statements will show up there

---

<div class="post-metadata">

**Author:** ![Andrew\_Dahabrah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrew_dahabrah/32/56284_2.png) [@Andrew\_Dahabrah](https://forum.inductiveautomation.com/u/Andrew_Dahabrah)\
**Post date:** [January 25, 2024, 7:08am UTC](https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753/5 "2024-01-25T07:08:06Z")

</div>

It looks like the event.newValue is a bool but when I changed event.newValue to False in the if statement it still wont show the message box. I put a print function inside the if statement and it never showed up in the console which tells me that the if statement is never evaluating to true.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 7:10am UTC](https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753/6 "2024-01-25T07:10:25Z")

</div>

The print statement should be put outside the if. The purpose is to see which property change events are occuring.

---

<div class="post-metadata">

**Author:** ![Andrew\_Dahabrah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrew_dahabrah/32/56284_2.png) [@Andrew\_Dahabrah](https://forum.inductiveautomation.com/u/Andrew_Dahabrah)\
**Post date:** [January 25, 2024, 8:12am UTC](https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753/7 "2024-01-25T08:12:49Z")

</div>

Yeah I did that first to confirm but I just put a print statement inside the if to see if the if was ever evaluating to true. It's not unfortunately.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 8:24am UTC](https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753/8 "2024-01-25T08:24:09Z")

</div>

What were the event names, and values that printed to the console?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 25, 2024, 8:33am UTC](https://forum.inductiveautomation.com/t/ignition-script-creates-duplicate-messageboxes/84753/9 "2024-01-25T08:33:48Z")

</div>

On the other hand, I should probably mention that I wouldn't use a gui locking popup for this. Perhaps a better approach would be to create a visual indicator like a label or an icon, and simply bind it's visibility property inversely to the data quality property.
