Sample script and output
- Last UpdatedJul 26, 2024
- 1 minute read
Read buffered data from the VTQ buffer
dim vtq as ValueTimeQuality;
dim strWriter as System.IO.StreamWriter;
LogMessage("Script Start");
strWriter = System.IO.File.AppendText("C:\\sample.txt");
FOR EACH vtq in me.UD1.buffer
strWriter.WriteLine("DAS value is "+vtq.value);
strWriter.WriteLine("Time stamp of the value is "+vtq.time);
strWriter.WriteLine("Quality of the value is "+vtq.quality);
strWriter.WriteLine("--------------------------------------");
‘Below messages will be logged to the Logviewer (or OCMC)
LogMessage("DAS value is "+vtq.value);
LogMessage("Time stamp of the value is "+vtq.time);
LogMessage("Quality of the value is "+vtq.quality);
next;
strWriter.Flush();
strWriter.Close();
LogMessage("Script End");
For each VTQ in this script sample, Value, Timestamp, and Quality are written to the sample.txt file.
For purposes of illustration, UD1 in the script sample is a buffer-enabled Integer attribute with input extended to a DDE item.
Sample output text written to text file
DAS value is 2
Time stamp of the value is 7/15/2010 11:28:54.880 AM
Quality of the value is 192
Sample output text written to logger
Info ScriptRuntime UD1.S1: Script Start
Info ScriptRuntime UD1.S1: DAS value is 2
Info ScriptRuntime UD1.S1: Time stamp of the value is 7/15/2010 11:28:54.880 AM
Info ScriptRuntime UD1.S1: Quality of the value is 192
Info ScriptRuntime UD1.S1: Script End