Cicode Programming Reference > Cicode Function Categories > Tag Functions Introduction > TagWriteEventQue

TagWriteEventQue

Opens the tag write event queue. The TagWriteEventQue is a queue of data containing details of tag value changes initiated by the process. To read events from the queue, use the QueRead() or QuePeek() functions. The queue contains timestamp, tagname and value data for each change event.

This queue is enabled by the corresponding INI parameter [General]TagWriteEventQue. Writes are logged to the queue for all tags whose IODevices have their Log Write parameter enabled.

Syntax

TagWriteEventQue()

Return Value

The handle of the tag write event queue, or -1 if the queue cannot be opened.

Related Functions

AlarmEventQue, QueRead, QuePeek

Example

To enable tag logging:

  1. On the client, set the INI param [General]TagWriteEventQue = 1.
  2. Enable the IODevices that you want to be logged by setting their Log Write parameters to TRUE. See I/O Devices Properties.

To read the queue you need to create a Cicode function. For example:

FUNCTION
checkWrite()
STRING sTagAndValue = "";
INT nDateTime = 0;
INT hQue = TagWriteEventQue();
IF hQue = -1 THEN
RETURN;
END
WHILE 1 DO
QueRead(hQue, nDateTime, sTagAndValue, 1);
Message("Value written", sTagAndValue, 64);
END
END

Where:

When the function is run, successful writes to tags on the IODevice will show as a message "Value written <tagname> <value>".

Note: The TagWriteEventQue is enabled on each process and will only log the data changes initiated by this process. By combining this data with the current user and machine name CitectSCADA can generate a user activity log with respect to setting data within the control system. This functionality can also be combined with CitectSCADA Reports to augment the detail of the historian data.

See Also

Tag Functions