INCLUDEREPLACED

Normally, when you query raw data from Historian, any values that have been replaced with a different value for the same timestamp are not returned. The INCLUDEREPLACED modifier helps you to indicate that you want replaced values to be returned, in addition to the currently retrievable data. However, you cannot query only the replaced data and the retrievable values that have replaced. You can query all currently visible data and get the data that has been replaced.

This modifier is only useful with rawbytime or rawbynumber retrieval. Do not use it with any other sampling or calculation mode.

Example

To illustrate this modifier, import the following 2 CSV files. Do not have replaced data in one CSV file.

This is the first file:

[Tags]
Tagname,DataType,HiEngineeringUnits,LoEngineeringUnits
REPLACEDDATA,SingleInteger,60,0
[Data]
Tagname,TimeStamp,Value,DataQuality
REPLACEDDATA,06-Aug-2012 9:01:00.000,1,Good
REPLACEDDATA,06-Aug-2012 9:02:00.000,2,Good
REPLACEDDATA, 06-Aug-2012 9:04:00.000,4,Good

This is the second file and replaces one data sample with a new value:

[Data] 
Tagname,TimeStamp,Value,DataQuality 
REPLACEDDATA,06-Aug-2012 9:02:00.000,3,Good

If you run a raw query as the following without any modifier, the value of 2 is not returned because it has been replaced.

select timestamp,value,quality 
from ihrawdata
where tagname = REPLACEDDATA and samplingmode=RawByTime and timestamp < now
Time StampValueQuality
8/6/2012 09:01:001 Good NonSpecific
8/6/2012 09:02:00 3 Good NonSpecific
8/6/2012 09:04:004 Good NonSpecific
Note: The value with 2 has not been returned.

To see the additional value of 2, run the query with INCLUDEREPLACED modifier as follows:

select timestamp,value,quality 
from ihrawdata
where tagname = REPLACEDDATA and samplingmode=RawByTime and timestamp < now and criteriastring="#INCLUDEREPLACED
timestamp       value quality
8/6/2012 09:01:00 1 Good NonSpecific
8/6/2012 09:02:00 2 Good NonSpecific
8/6/2012 09:02:00 3 Good NonSpecific
8/6/2012 09:04:00 4 Good NonSpecific
Note that the value with 2 has been returned now.
Anticipated Usage

The INCLUDEREPLACED modifier can be used to detect and recover data that was overwritten by mistake. With a User API program, you can determine the samples that have been replaced and then build a CSV file and import with the File Collector.