SendEvent

Sends an event to the Event Logger.

Function Group Execution Windows Embedded Thin Client
SendEvent Event Logger Synchronous Supported Supported Supported

Description

Use to send an event to the Event Log file. When the Comment option is enabled, the user is prompted to enter a comment after executing the SendEvent() function. This comment will be saved in the Event Log file.

Syntax

SendEvent( strEvent, optBoolFlag, optStrComment )
strEvent
The text to be saved in the Event Logger.
optBoolFlag
If omitted or 0 (zero), the event does not have a comment. Otherwise, there is a comment associated to the event.
optStrComment
The text of the comment for the event saved in the database. If omitted, a standard dialog prompts the user to type a comment.

Returned value

0 Success
1 Event Logger is disabled in the Event Settings dialog
2 Event Logger is enabled, but Custom Messages are disabled in the Event Settings dialog

Notes

This function is synchronous. Therefore, the execution of the function finishes only after the event data (including the comment, if any) is saved in the database file. It is recommended that you do not configure this function in background tasks (e.g., Math and Scheduler), unless you do not plan to use the comment or configure it directly (type from the dialog) in the function.

Examples

Tag Name Expression
Tag SendEvent( "Valve Open" ) // Saves the event message.
Tag SendEvent( "Valve Open Oven No. " + OvenID ) // Saves the event message concatenated with the value of the OvenID tag.
Tag SendEvent( "Valve Open" , 1 ) // Displays the dialog where the operator can type comments.
Tag SendEvent( "Valve Open" , 1 , TagComment) // Saves the event message with the comment configured in the TagComment tag.