# Write on change

**URL:** <https://forum.inductiveautomation.com/t/write-on-change/77867>\
**Category:** Ignition\
**Tags:** ignition78, scripting\
**Created:** [August 15, 2023, 2:32pm UTC](https://forum.inductiveautomation.com/t/write-on-change/77867 "2023-08-15T14:32:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Summers](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@James\_Summers](https://forum.inductiveautomation.com/u/James_Summers)\
**Post date:** [August 15, 2023, 2:32pm UTC](https://forum.inductiveautomation.com/t/write-on-change/77867/1 "2023-08-15T14:32:15Z")

</div>

I have a machine connected to my Ignition system that we are using a photo eye to count pallets as they go by. I have the history of the tag set up like this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/c/6c34c932caad9787c01ff90c8c9e88f2b4afc466.png)

What I want to happen is every time the tag changes value I want that value to be written to MSSQLDatabase. As I began writing this I noticed the value mode and that I have it set to analog. I have since changed it to discrete and the results are the same. Some of the data comes back to SQL but not all. I assume I need to use a client change event script. I am in the process of learning how to code in python (or any text based code for that matter) but have just begun that. What function would I need to use? Some ideas on the syntax of the script would also be helpful. Thanks

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 15, 2023, 3:16pm UTC](https://forum.inductiveautomation.com/t/write-on-change/77867/2 "2023-08-15T15:16:32Z")

</div>

Also set your deadband to zero. Do keep in mind that it cannot record faster than the device is being polled by your driver. You may need a different scan class with a faster rate.

---

<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:** [August 15, 2023, 3:20pm UTC](https://forum.inductiveautomation.com/t/write-on-change/77867/3 "2023-08-15T15:20:39Z")

</div>

{added the Ignition 7.9 tag so you hopefully don't get answers targeted at Ignition 8}

---

<div class="post-metadata">

**Author:** ![James\_Summers](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@James\_Summers](https://forum.inductiveautomation.com/u/James_Summers)\
**Post date:** [August 16, 2023, 7:46pm UTC](https://forum.inductiveautomation.com/t/write-on-change/77867/4 "2023-08-16T19:46:09Z")

</div>

Thanks Phil! I was over complicating it. It was the scan class.

---

<div class="post-metadata">

**Author:** ![James\_Summers](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@James\_Summers](https://forum.inductiveautomation.com/u/James_Summers)\
**Post date:** [August 16, 2023, 7:46pm UTC](https://forum.inductiveautomation.com/t/write-on-change/77867/5 "2023-08-16T19:46:54Z")

</div>

Thanks so much but it's actually 7.8

---

<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:** [August 16, 2023, 7:47pm UTC](https://forum.inductiveautomation.com/t/write-on-change/77867/6 "2023-08-16T19:47:42Z")

</div>

There ya go.
