2 Replies Latest reply on Dec 18, 2018 7:27 PM by Rick Davin

    Does PI AF has a method to accept multiple tags and return their values?

    johan.pakpahan

      I am aware that PI AF methods accept one tag and return its value. Are there methods that accept multiple tags and return their values in one method call? I have a lot of tags, iterating them to get values takes time. If there are methods to allow multiple tags, then I assume that it will be more efficient.

        • Re: Does PI AF has a method to accept multiple tags and return their values?
          vkaufmann

          Hi Johan,

           

          I suggest you take a look at the PIPointList class and the AFAttributeList class to accomplish data retrieval in bulk.

           

          PIPointList Class

          AFAttributeList Class

           

          --Vince

          3 of 3 people found this helpful
          • Re: Does PI AF has a method to accept multiple tags and return their values?
            Rick Davin

            You are correct that such a method would be more efficient since it reduces the number of round trips to a remote server.  Vincent Kaufmann  gave you the main classes that allow for bulk reads.  If you are writing a Tag-based application, PIPointList is what you want.  It has the CurrentValue method (formerly Snapshot).  The name is singular but does return many values.  It uses the singular tense because it returns one value per tag.  The RecordedValue method also returns one value per tag.  The RecordedValues method returns many values per tag and is limited by the ArcMaxCollect tuning parameter, most likely set to 1.5 million values.  The caution with anything grabbing too many values is not to bust past ArcMaxCollect, which means you may need to reduce the number of tags in the collection, or the time range.

             

            If you are writing an Asset-based application, then AFAttributeList is what you want.  However, its bulk data method calls require using the AFAttributeList.Data property.  Your attributes do not need to be PI points, and how well the calls work depend upon the data reference being used.  If you have custom data references, you need to ensure they work with bulk methods.

            3 of 3 people found this helpful