1 Reply Latest reply on Mar 28, 2018 4:15 PM by John Messinger

    How can I replace a bad tag value with the previous value of the tag?

    srburnet

      We are getting occasional bad data values, always the same large negative number, from an external system operator. I have no ability to make them resolve the problem that is generating the large negative value, so I have been manually dropping the bad value and recalculating all the derived values. Is it possible to create a calculation that replaces the large negative value with the prior value of the tag before it's passed to the rest of our calculations?

        • Re: How can I replace a bad tag value with the previous value of the tag?
          John Messinger

          Hi Stuart,

           

          If you are using an AF Expression Analysis, you could add a named intermediate variable calculation at the beginning of your analysis to do this:

           

          If 'Attribute'  = -123456789 Then PrevVal('Attribute', '*') Else 'Attribute'

           

          You would then use the this named intermediate variable to access the validated value in the remaining steps of your calculation.

           

          If this particular tag value is used across multiple calculations, then you would need to write this particular calculation result to a 'validated' tag, and use the validated tag as an input to the other calculations, rather than the 'raw' tag.

           

          John

          3 of 3 people found this helpful