Search code examples
wonderwarehistorian

Some datetime filters on Wonderware Historian queries returns no data


I'm querying to Wonderware Historian Database from SQL Server Management Studio and found that sometimes I don't get values, depending on the datetime filters I've set, even using Full retrieval mode.

I can get the values for the first ten days of October with this statement:

SELECT *
FROM   Runtime.dbo.History
WHERE  TagName = 'SFRL_JP\QInst' 
  AND  wwRetrievalMode = 'Full' 
  AND  wwQualityRule = 'Extended' 
  AND  wwVersion = 'Latest' 
  AND  DateTime >= '20191001 00:00:00'
  AND  DateTime <= '20191101 00:00:00';

But if I change de start date to October 2 (or any day after) the query only returns a tupla with value 0:

SELECT *
FROM   Runtime.dbo.History
WHERE  TagName = 'SFRL_JP\QInst' 
  AND  wwRetrievalMode = 'Full' 
  AND  wwQualityRule = 'Extended' 
  AND  wwVersion = 'Latest' 
  AND  DateTime >= '20191002 00:00:00'
  AND  DateTime <= '20191101 00:00:00';

Get same results using Historian Query and Historian Trends.

All returned data with the first statement seems to be good (QualityDetail = 192 and OPCQuality = 192).

I can't see what's wrong in the second query.


Solution

  • It looks like the latest.dat files get corrupted over a period of time, so I've tried to export the existing data for those dates in .csv file, and then upload this new set of CSV files specifying "Original Values" instead of "Update Values" and process them via FastLoad for that specific tag and check the values. Queries seems to be ok, but after a couple of days same error appears again.

    Finally, solution comes from installing a patch on Historian: Wonderware Historian 11.6 SP1 P02 .