writeAuditEntry()

The function writeAuditEntry is used to write set point values into the Audit trail panel.

Synopsis

writeAuditEntry(anytype dpe,anytype oldvalue,anytype newvalue,int &error, string reason = "");

Parameters

Parameter Description
dpe The data point element (e.g. string dpe = "threshold_value"). Can also be a dyn_string.
oldvalue One or more values. If the parameter dpe is of type dyn, several values can be written (e.g. float oldValue = 85).
newvalue One or more values. If the parameter dpe is of type dyn, several values can be written (e.g. float newValue = 80).
&error

Returned error code

If the return code is 0 there is no error

If the return code is -1then the dynlen(oldvalue) !==dynlen(newvalue). This means that several values were set at the same time and the number of values does not match.

reason = "" Reason (an arbitrary text) why the value was changed. Default value is empty .

Return value

-

Errors

Missing or incorrect arguments

Description

The function is used for set points (e.g. for set point of water level or threshold value for injection molding) and writes the old and new values as well as the reason why the value was changed. The reason is, however, optional and can be left empty. Note that if you want to get the data point configurations (value changes) from PARA into the Audit Trail panel you have to call this function. The values are not written automatically into the Audit Trail panel.

Example

The function writes the used device (dpe) "threshold_value", old value 85 and new value 80 and the reason why the value was changed "Too high temperature at injection molding" into the Audit Trail panel.

 main()
{
  string dpe = "threshold_value";
  float oldvalue = 85;
  float newvalue = 80;
  string reason = "Too high temperature at injection molding";
  int error;
  writeAuditEntry(dpe,oldvalue,newvalue,error,reason);
  DebugN(dpe,oldvalue,newvalue,error,reason);
}

Assignment

User administration

Availability

UI