Tag Value change event log in audit_events table

Hi Pat and JordanCClark,

Thank you for the code, :laughing:

I have perpared the code as per attached and It is working fine. Also please refer Event log sanpshot.

I want to understand below few points.

  1. I have comparing initialChange bit status in the Tag value change event script. Hence the false (unnecessary) events were not logged at the time, when I SAVE and PUBLISH the project.

A. But I am getting unnecessary events logged, in database when I change or modify the UDT. Is there any provision to avide unnecessary event logging, which will logged into the database when the UDT changed or modified.

B. Instead of using “If and Else” condition. Can I use directly like ( if initialChange == 0: then run the code.) witout using else, It will work? I had tried, using only If condition (without else), all code will run and unnecessary events gets logged in to the DB. Hence I am using the If and Else condition as shown in snapshot.

  1. Is Tag value changed (if newValue.value ‘:’) need to be comapre to aviod unnecessary events? or We need to compare between perviousValue.value and newValue.value like ( if perviousValue.value <> newValue.value: ) then run code?

  2. I have one UDT (Pump) and I written the code in 3 UDT tags. Is the indiviual scripting will load the system?

A. I am using UDT so I need the Master tag name in the Event Tag Path Field, so i have using UDT parameters in the Code to prepare tag path. Could we use shared scripting function and UDT parameters same time?

  1. Is the shared scripting function is the best option as you had explained?

Thank you in advance.




2 Likes