AnsweredAssumed Answered

Is there a PrevVal equivalent in the formula DR?

Question asked by arosenthal on May 17, 2017
Latest reply on May 23, 2017 by tmcmanus

I am trying to use the Formula Data Reference to perform simple calculations, where the input variables are Table Lookup Data References that are configured to return time series data. My use case for this is to perform simple calculations on data with future timestamps. So far this has worked out well for me, and the output attribute returns a time series with future data as expected (when I request time ranges that extend into the future).


Now I want to include another input variable that refers to a PI Point Data Reference. The issue I am facing is that I want the Formula DR to only evaluate the most recent archived value for the PI Point DR, even when evaluating the Formula DR expression at future times. Essentially, I am trying to use the PrevVal function in the Formula DR, but this does not seem to be available.


Is there a solution that makes this possible? I have tried numerous things, including:


  • Setting the value retrieval method for the PI Point DR to "Before" or "At or Before"
  • Using an AF Analysis to output the result of PrevVal('Tag', '*') to an output attribute
  • Routing the value of the PI Point DR to another attribute configured using the String Builder DR


However, none of these seem to be working. When the Formula DR evaluates this input at future timestamps, it gets back "No Data," which causes the entire Formula DR to fail. The only way I have found to prevent the Formula DR from failing is to use a BadVal check on the input variable and return a fixed default value, but this is not a viable solution for my particular use case.


Interested to hear your thoughts on this problem.