4 Replies Latest reply on Feb 9, 2015 12:52 PM by lgferrao

    The data methods PlotValues and RecordedValues are not supported on attribute

    lgferrao

      Hi,

      I'm trying to get attributes values to plot them in a graph. This information is importante: the graphs have more than one trend (each one from a different attribute).

       

      To do this, I'm using the code below:

       

      protected override IList<AFValues> GetAttributesValues(IEnumerable<string> pointNames, AFTimeRange timeRange, int intervals, PIPagingConfiguration paging)

      {

          var attributes = AFAttribute.FindAttributesByPath(pointNames, null).Results;

       

          var attributesList = new AFAttributeList(attributes.Values);

       

          return intervals == 0 ?

              attributesList.Data.RecordedValues(timeRange, AFBoundaryType.Inside, null, true, paging).ToList() :

              attributesList.Data.PlotValues(timeRange, intervals, paging).ToList();

      }

       

      I'm not an expert in AF SDK, but I read that using attributesList.Data is the fastest way to retrieve values from attributes.

       

      The problem is that the AF SDK (PI AF Client 2014 R2 - 2.6.1.6238) is returning a message tell me that PlotValues and RecordedValues are not supported to an specific attribute.

       

      This attribute is configured in PI Explorer as:

      \\sesaupid01\367201_1231_FI_105;TimeMethod=TimeRange;RelativeTime=-30m;TimeRangeMethod=Average

       

      I get the values from this attribute using the method GetValues, but I don't know if this is the more performatic way.

       

      So, I need some help to develop a code that works with performance and be able to handle diferent kinds of datareference configurations.

       

      Thank you in advance!

        • Re: The data methods PlotValues and RecordedValues are not supported on attribute
          dng

          Hi Luis,

           

          When you are using TimeRange in the PI Point data reference, some data methods are not supported (e.g. PlotValues and RecordedValues) as you have pointed out. In fact, you can query the AFAttribute.SupportedDataMethods Property to find out what data methods are supported. This actually calls AFDataReference.SupportedDataMethods for the data reference.

           

          If we are working with a complete list of random attributes that could have different data references and different time methods, we could potentially include the SupportedDataMethods check before using a specific data retrieval methods. However, this is not ideal because we will have to query and retrieve attribute values one at a time. Ideally, we should already have an idea of what attributes we are working with, and pick the best data retrieval method for the list. So let us know what kind of attributes are contained in your attribute list.

           

          Regarding performance difference between GetValues and Data.RecordedValues, let me look up some information for the PI Point Data Reference. Let me know if you are indeed using other data references.