Update QualityRule=0 in Historian

Hello @all, I recently tried (Testing) to set Values to bad quality for a customer, so the Values are not shown in HistorianClient when Good Quality is used in the Filter-Settings.

For my Understanding there are two options.

1.) Use 'Insert' - To get a bad 'latest' Value with QualityDetail 202 and OPCQuality 64. This most of the time is ok for me.

INSERT History (TagName, DateTime, Value, wwVersion, OPCQuality)

SELECT TagName, '2024-08-16 09:00:00', Value, 'LATEST', 64

FROM History

WHERE TagName='test_sqlinsert_0824'

AND wwRetrievalMode = 'FULL'

_____________________________________________________________________________

2.) Use 'Update' - Here I do not really Understand what ist happening:

2.1.) create tag

2.2) insert and verify Values

2.3) Update

2.4) Verify that the Values are set to QualityDetail = '0'

So Finally: When I tried to verify that the Values have been updated as I expected, I get a different result. As you see Im not able to return the Values anymore.

I tried Qualityrules 'Extended' / 'Optimistic'. Do I may have to use a special Query to return the modified Values?  [I tested in Historian 20.1.100.000 and also 17.3.000.000 - Same result]

Thanks for any Hints, Ideas - Elias.

Parents
  • Though the OPC standard allows "bad" quality to include a value, Historian does not--"bad" quality always has a "NULL" value. For your scenario it might make sense to use an "uncertain" quality (e.g. 64) instead--the value is still exposed and it can be distinguished from normal "good" values. 

    Also, this won't fundamentally change what you're seeing, but it is preferable to set the "OPCQuality" (externally reported data quality) rather than "QualityDetail" (the internal Historian status). It is common for these two quality attributes to be the same, but they do have different purposes.

  • Hi Elliott, thanks for your fast reply! - so I think for me the insert statement is the better option, to set the OPCQuality to 64 e.g.

    USE Runtime

    INSERT History (TagName, OPCQuality, Value, DateTime, wwVersion)
    SELECT TagName, 64, Value, DateTime, 'LATEST'
    FROM History
    WHERE TagName='test'
    AND DateTime >= '20000101 00:00:00.000'
    AND DateTime < '20000201 12:00:00.000'
    AND wwRetrievalMode = 'FULL'

    I tried to use Update Statement because I have some trouble with Tags using chars "ä,ü...". May I will get back to this next week because neither "insert" nor "update" worked for these tags. Nevertheless, thanks a lot for the help with the last topic.

Reply
  • Hi Elliott, thanks for your fast reply! - so I think for me the insert statement is the better option, to set the OPCQuality to 64 e.g.

    USE Runtime

    INSERT History (TagName, OPCQuality, Value, DateTime, wwVersion)
    SELECT TagName, 64, Value, DateTime, 'LATEST'
    FROM History
    WHERE TagName='test'
    AND DateTime >= '20000101 00:00:00.000'
    AND DateTime < '20000201 12:00:00.000'
    AND wwRetrievalMode = 'FULL'

    I tried to use Update Statement because I have some trouble with Tags using chars "ä,ü...". May I will get back to this next week because neither "insert" nor "update" worked for these tags. Nevertheless, thanks a lot for the help with the last topic.

Children
No Data