The Audit Trail is a security-relevant chronological set of records that provide documentary evidence of the activities that have affected a specific operation, procedure, or event at any time.
On this page:
To use the Audit Trail function, Access Alarms → Global Settings and check the Enable Audit Trail box to activate it.
Besides the Enable option, you can choose which actions the Audit Trail database stores. The options are as follows:
It is possible to enable any of these options during runtime by using the Alarm Namespace properties through the following syntax: ``@Alarm.AuditTrail.<Audit Trail Option>`` |
It is possible to enable any of these options during runtime by using the Alarm namespace properties. The syntax is:
@Alarm.AuditTrail.<Audit Trail Option> |
To visualize the stored Audit Trail data, you can add an AlarmWindow element to your display and select the AuditTrail option in the ComboBox list.
One of the most important features of the Audit trail is the ability to have customizable messages added to a historian database. Custom messages are added in runtime using the method below:
@Alarm.AuditTrail.AddCustomMessage(string message, string areaName, string objectName, string value, string itemName, string auxValue, string comment) |
Where:
The messages can either be text or a concatenation between text and real time info from the project. For messages that are only text, you will need only the message parameter. E.g.:
@Alarm.AuditTrail.AddCustomMessage("The day is sunny") |
An example on the usage of text and project info is:
@Alarm.AuditTrail.AddCustomMessage("User: " + @Client.UserName + " logged"); |
To translate text into different languages, you first need to create a set of words in a custom dictionary. Go to Displays → Localization. On the top of the display, you will find some buttons:
Import Localization Strings
To apply this feature to the custom messages in the Audit Trail, you must follow a certain syntax.
@Alarm.AuditTrail.AddCustomMessage("tag changed value, AckRequired"); |
string message = "User: {" + @Client.UserName + "} logged" |
The alarm database will contain characters ” { ” and ” } ” in the Message column. The dictionary must also contain the brackets characters. |
You must add another string element to the itemName input parameter, as seen below:
string itemName = "{object}" |
A final AddCustomMessage with localization capabilities should look like this:
@Alarm.AuditTrail.AddCustomMessage("User: {" + @Client.UserName + "} logged", null, null, null, "{object}", null, null); |
For reports with different translation options, the first requirement is the creation of Dictionaries on Displays → Localization.
To switch between languages, use the property:
@Client.Localization = "" // for default dictionary //or @Client.Localization = "<Dictionary_Name>" |
To have a translated Alarm AuditTrail with Custom Messages and Comments in Reports, the addition of a callback function on Script → Classes → ClientMain is required. This function is called every time the DataGrid object is modified.
The Callback function syntax is as follows:
public void OnReportCustomTableCell(string reportName, string columnName, System.Data. DataRow row, System.Windows.Documents.TableCell tableCell) { // Insert Code Here } |
The code added to the callback function is presented below:
public void OnReportCustomTableCell(string reportName, string columnName, System.Data.DataRow row, System. Windows.Documents.TableCell tableCell) { if (row["ItemName"].ToString() == "{object}") { string[] Message_Split_Parts = row[columnName].ToString().Split(’{’, ’}’); string Translated_Message = ""; for (int i = 0; i <= Message_Split_Parts.Length - 1; i++) { // Translate the custom message part Translated_Message += @Client.Locale(Message_Split_Parts[i]); Run cellText = (tableCell.Blocks.FirstBlock as Paragraph).Inlines.FirstInline as Run; // Replace the original message with the translated one. cellText.Text = Translated_Message; } } } |
The Datagrid language will depend on the dictionary that was enabled when the report was saved.
In this section: