Writing current time to Memory Tag not working

Hello, I'd like to write current time to a memory tag everytime I have a change in a PLC variable. I am writing the script shown in the picture above inside the PLC variable, but the memory tag is not updating. What am I doing wrong?

Any help would be greatly appreciated!

Thanks,
Luke

You are checking initialChange too late. Check it before any use of previousValue to avoid an error that kills your script.

Also, a typo - system.data.now is not a real function; system.date.now is.

3 Likes

Oh my... I've been staring straight at that typo for hours. You're a life saver. Thank you!

To note, at the top right of that dialog, there is a button that will show the Tag Diagnostics (Looks like an ECG line) , this would have announced the typo to you, and probably have saved you a little hair along the way.

5 Likes

Incredibly useful, thank you lrose!