INCLUDEDELETED
The INCLUDEDELETED modifier retrieves the value that was previously deleted. Data that has been deleted from the archiver is never actually removed but is marked as hidden. Use the INCLUDEDELETED modifier to retrieve the values that were deleted, in addition to any non-deleted values during the query time period.
This modifier is only useful with rawbytime or rawbynumber retrieval. Do not use it with any other sampling or calculation mode.
- Example
-
Import this data to demonstrate the behavior of the INCLUDEDELETED query modifier.
[Tags] Tagname,DataType,HiEngineeringUnits,LoEngineeringUnits DELETEDDATA,SingleInteger,60,0 [Data] Tagname,TimeStamp,Value,DataQuality DELETEDDATA,06-Aug-2012 9:01:00.000,1,Good DELETEDDATA,06-Aug-2012 9:02:00.000,2,Good DELETEDDATA,06-Aug-2012 9:04:00.000,4,Good
Delete the raw sample at 9:02 and query the raw data without any modifier and you will get only the non-deleted values.
Run the following query:
select timestamp,value,quality from ihrawdata where tagname = DELETEDDATA and samplingmode=RawByTime and timestamp < now
Time Stamp Value Quality 8/6/2012 09:01:00 1 Good NonSpecific 8/6/2012 09:04:00 4 Good NonSpecific Query with the INCLUDEDELETED modifier and you will get the deleted sample together with the non-deleted data.
select timestamp,value,quality from ihrawdata where tagname = DELETEDDATA and samplingmode=RawByTime and timestamp < now and criteriastring="#INCLUDEDELETED"
Time Stamp Value Quality 8/6/2012 09:01:00 1 Good NonSpecific 8/6/2012 09:02:00 2 Good NonSpecific 8/6/2012 09:04:00 4 Good NonSpecific - Anticipated Usage
-
The INCLUDEDELETED modifier can be used to detect and recover deleted data. Perform a query without the modifier and with the modifier and compare the results. You will detect the deleted samples. You can also determine the deleted samples with a User API program.