EditData

(Historian Manager Library)

Description: Subroutine to write a new history value and to write the data note for manual data editing.
Returns: Nothing
Usage: Script Only.
Function Groups: Log
Related to: GetTagHistory | WriteHistory
Format: \HistorianManager\EditData(TagObj, NewValue, StartTime[, EndTime, NoteText, NoteOnly, RemoveOverride, LogVar, pError])
Parameters:  
TagObj
Required. Tag object for which data is being edited.
NewValue
Required. The new value to write. If Invalid, an Invalid will be written.
StartTime
Required. The UTC timestamp. Will be used as the timestamp for a single value, or the start of a range if an EndTime is provided.
EndTime
Optional. The UTC timestamp for the end of a range of data edits. Defaults to StartTime.
NoteText
Optional text. A note to be included with the edit.
NoteOnly
Optional Boolean. Set to TRUE if only the note should be logged and not the value. Defaults to FALSE.
RemoveOverride
Optional Boolean. Set to TRUE if the record(s) should revert to original.
LogVar
Optional text. The name of the loggable variable. Defaults to "Value".
pError

Optional pointer. Will be set to an error code or structure. See notes in GetTagHistory.

 0 No error
-1 The number of timestamps passed in WriteHistory() does not match the number of data entries passed in.
-2 Invalid tag object
-3 Invalid StartTime timestamp
-4 Failed to add note
-5 No notebook found
-6 Value cannot be edited
Comments:

HistorianManager.EditData() is used to write a historical value at a certain time or time range. If there is existing data at that time, the new value overrides the old value and is marked as an edit, otherwise the value is written and marked as a manual entry. The old value is never removed.

If a time range is specified, any historical values within the range are overridden. If the beginning of the time range does not overlap with an existing value, a new value is recorded at that time.

EditData can be called to add a note to a value without changing the value. EditData can also be called to remove all overrides, in which case values revert to the most recent non-manual value for each timestamp, and to remove manual entries, in which case it reverts to the most recent value.

Whenever a value is overridden, inserted, or reverted, a note is added. Only a single note is added when a time range is specified, where the start time becomes the note's timestamp, and the end time is stored within the note.

Only tags with value attributes and with a single loggable value can be edited

Example:

None provided. Not intended for use outside the Historical Data Viewer grid view.