8 Replies Latest reply on Dec 6, 2018 2:00 PM by Mattpdrexel

    PI AF - Table Lookup Data Reference BETWEEN two values in table

    Mattpdrexel

      I am interested in creating a PI AF Attribute that returns the value of a column when a certain PI Point Attribute is between two values from a reference Table.

       

      For example, for the table below, I'd like to return the appropriate value from [Output Value] for a given PI AF Attribute input.

       

      Here, the PI Point is called as @[PI AF Attribute], which is dynamic and will change continuously.

       

      Attempted Query:

      SELECT [Output Value] FROM [Example Table] WHERE [Low Range] <= @[PI AF Attribute] AND [High Range] <= @[PI AF Attribute]

      For example, if @[PI AF Attribute]  were to equal 8.5, I'd expect the output to be 5.

       

      Low RangeHigh RangeOutput Value
      034.6
      364.7
      6105
      9124.6

       

      However, the PI AF SQL type query returns 'None' as an output when I attempt this within PI AF for my real data (see attached).

       

      I am not sure how to achieve this table lookup given.

      Any suggestions would be highly appreciated.

       

      I understand this would be simpler with Interpolation, but I am trying to avoid that.

       

      Thanks!