Skip to main content

ReadHistoryModified

If the server allows write history (data has been modified), ReadHistoryModified retrieve a snapshot of every modification record within that range.

It cannot retrieve "who made the change."

Currently the SDK exposes only the DataValue entity itself (Value / Status / the two timestamps). In the OPC UA modification record, ModificationInfo(Who made the change / When was it made / Previous value)No properties are provided.. SoCan't Use it for compliance audit traceability—all you can see is "this point was modified and changed to this value"; you can't see who made the change or the original value.

Preliminary / Supporting

Signature​

public IReadOnlyList<DataValue> ReadHistoryModified(
string nodeId,
DateTime start,
DateTime end,
uint maxValues = 0,
bool returnBounds = false);
ParametersTypeDefaultNote
nodeIdstring—Target; NodeId null / empty string exception ArgumentNullException
startDateTime—Range starts at (UTC)
endDateTime—Range Stop (UTC)
maxValuesuint0Maximum number of rows returned per query; 0 = no limit (passed to the server as-is)
returnBoundsboolfalseWhether to return the boundary values of the range (passed through to the server as-is)

Return value and ReadHistory Same type: IReadOnlyList<DataValue>, where each record is a DataValue (Value / Status / SourceTimestamp / ServerTimestamp).

Edit Information

Edit details such as "who edited it, when it was edited, and what the new type is" for each record are not SDK currently provided; only the entity DataValue itself is displayed. DataValue The timestamp inThis data entry itself A timestamp is not the "time when a change occurred."

Usage​

using System;
using DarraOpcUa_Client;

using var ua = new DarraOpcUa("opc.tcp://localhost:4840");
ua.Connect();

var today = DateTime.UtcNow;
var yesterday = today.AddDays(-1);

var modified = ua.ReadHistoryModified("ns=2;s=Temperature",
start: yesterday, end: today);

foreach (var dv in modified) using (dv)
Console.WriteLine($"{dv.SourceTimestamp:O}: {dv.Value} ({dv.Status})");

Each one is DataValue IDisposable, Must Release. To retrieve the value dv.Value.AsDouble, use, which returns double?, pass directly to formal parameter double = CS1503 Fails to Compile。

When to Use​

  • Revision History: Check how many times a point has been modified within the interval, along with a snapshot of its value at each modification (information on "who modified it" and "when it was modified" is not available; see the warning above)
  • Cannot be used for compliance audits: Cannot retrieve operator / operation time / previous value

Exception​

ExceptionTrigger Conditions
ArgumentNullExceptionnodeId null / empty string
OpcUaExceptionThe server returns a value other than; Good;ex.StatusCode this is the code returned by the server as-is.

Implementation Constraints​

  • None CancellationToken —— Only ReadHistoryStreamAsync Include the cancellation token.
  • Synchronous Blocking, No variants Async.
  • Session-level failures are not automatically retried —— and ReadHistory It's different; it won't automatically reconnect and retry once.
  • Do not expose ModificationInfo; see the warning above.
  • Do not reveal ContinuationPoint.

Server Requirements​

  • We must make history
  • The revision history must be preserved (rather than overwritten).
  • User credentials must be passed correctly (Username / Certificate Token)

Next Step​