FILTERINCLUDEBAD

The FILTERINCLUDEBAD modifier directs the Data Archiver to consider the values of bad quality data when determining the time ranges that match the filter condition. This modifier is similar to the INCLUDEBAD but that modifier applies to the data tag and this modifier applies to the FilterTag.

You can use the FILTERINCLUDEBAD modifier if you are also using INCLUDEBAD because your application data of bad quality has meaningful values then you can also consider this modifier but, you do not need to use both modifiers at the same time.

Example: Filtered Data Query containing Bad Quality Filter Values

Import this data to demonstrate the behavior of the FILTERINCLUDEBAD query modifier:

[Tags]
Tagname,DataType,HiEngineeringUnits,LoEngineeringUnits
ExcelTag1,SingleFloat,60,0
[Data]
Tagname,TimeStamp,Value,DataQuality
ExcelTag1,07-05-2011 17:24:00,29.72,Bad
ExcelTag1,07-05-2011 17:25:00,29.6,Good
ExcelTag1,07-05-2011 17:26:00,29.55,Good 
ExcelTag1,07-05-2011 17:27:00,29.49,Bad
ExcelTag1,07-05-2011 17:28:00,29.53,Bad

The given sample contains three bad quality data samples. Run the following query:

set starttime='07-05-2011 16:00:00', endtime='07-05-2011 21:00:00'
select timestamp,value,quality from ihrawdata where tagname=ExcelTag1 and samplingMode=Calculated and 
calculationmode=rawtotal and FilterExpression ='ExcelTag1>29.5' and numberofsamples=1

In this query, we use a filtered expression where the filter condition is ExcelTag1>29.5, and the result is as follows because it adds the two good values to compute the RawTotal:

Time StampValueQuality
7/5/201121:00:0059.149999618530100.0000000

Bad quality data is not considered while filtering. If you want to consider bad quality data then use the FILTERINLCUDEBAD query modifier together with the INCLUDEBAD query modifier as in the following query:

set starttime='07-05-2011 16:00:00', endtime='07-05-2011 21:00:00'
select timestamp,value,quality from ihrawdata where tagname=ExcelTag1 and samplingMode=Calculated and 
calculationmode=rawtotal and FilterExpression ='ExcelTag1>29.5' and numberofsamples=1 and CriteriaString='#FilterIncludeBad#IncludeBad'

The result is as follows

Time StampValueQuality
7/5/201121:00:00118.399999618530100.0000000
Note: The value is 118 because all the values that are greater than 29.5 are added together, not just the good quality values.
Anticipated Usage

The FILTERINCLUDEBAD modifier can be used to force the Data Archiver to consider every raw sample collected from a field device when determining the time ranges while still excluding Historian injected end of collection markers or calculation errors and timeouts.