# ValueChanged script on Expression Tag Freezing

**URL:** <https://forum.inductiveautomation.com/t/valuechanged-script-on-expression-tag-freezing/87858>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [March 25, 2024, 6:49pm UTC](https://forum.inductiveautomation.com/t/valuechanged-script-on-expression-tag-freezing/87858 "2024-03-25T18:49:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Fabiano](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@Alex\_Fabiano](https://forum.inductiveautomation.com/u/Alex_Fabiano)\
**Post date:** [March 25, 2024, 6:49pm UTC](https://forum.inductiveautomation.com/t/valuechanged-script-on-expression-tag-freezing/87858/1 "2024-03-25T18:49:36Z")

</div>

Good afternoon,

We have a program on Ignition that reads bits from a plc and tries to match them up with faults on a global scripting project script.

![collector1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0f1b4fcd8756bbf34fdf200abe7baf82c16b8328.png)

The tag Collector concatenates 10 OutputStrings0-9 into a large string like:

```auto
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

```

This string is then sent off via a valueChanged() script:

```auto
def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
	if missedEvents == True:
		meDS = system.tag.read("[.]Missed Events").value
		data = (currentValue.value,system.date.now())
		meDS = system.dataset.addRow(meDS, data)
		system.tag.write("[.]Missed Events", meDS)
	Corporate_Monitor.extractor(tag, tagPath, currentValue.value, previousValue.value, faultsType=tag['parameters']['faultType'])

```

The problem is that sometimes, the collector freezes and stops updating itself based off of the values in the OutputStrings changing.  
This problem can be easily manually fixed by just right clicking the collector tag and hitting 'Refresh'. But until we do this, the tag stays frozen.

We were thinking of ways to try to resolve this, like enabling/disabling the collector every 5 minutes, or binding it to some FlipFlop like

```auto
//Always evaluates to same path, but forces refresh of value scans
if({[.]ChangeFlip},
concat({[.]OutputString0},{[.]OutputString1},{[.]OutputString2},{[.]OutputString3},{[.]OutputString4},{[.]OutputString5},{[.]OutputString6},{[.]OutputString7},{[.]OutputString8},{[.]OutputString9}),
concat({[.]OutputString0},{[.]OutputString1},{[.]OutputString2},{[.]OutputString3},{[.]OutputString4},{[.]OutputString5},{[.]OutputString6},{[.]OutputString7},{[.]OutputString8},{[.]OutputString9}))

```

But both of these options seemed somewhat expensive for the number of tags we would be using it on.  
Is there a better way to do this?  
Why is our expression tag freezing?

Thank you,  
Alex
