Question:
How can I have some tags recorded in a database only when another’s I/O tag value turns 1?
Solution:
To do so, follow these procedures:
- Create a Historic with the tags that you want to record;
 - Set up Add a new record every X ms as 0; by doing this, you will disable the automatic recording;
 - Create a script with If command in the tag’s OnRead event to check the tag’s value; when it is equal to 1, Historic‘s WriteRecord() method will be executed.
 
Example:
Sub IOTag01_OnRead()
   if Value = 1 then
      Application.GetObject("Hist1").WriteRecord()
   end if
End Sub
