5 Replies Latest reply on Jul 28, 2016 5:59 PM by vwitzel

    Set/remove Q-bit of tag values over timerange

    jfitie

      Hello all,

       

      Does anyone know if there is an easy way to set or remove the questionable bit on all values of a tag over a timerange (without having to use UpdateValues to update all of the values in the PI archives) using VB .Net (want to create an app to do this)?

       

      The only way I can think of is to use the SDK to read all the tags values in a PIData object, then changing the NamedValueQuestionable’ and then use UpdateValues to update all values on the server.

       

      This will probably be very slow and quite CPU/memory intensive for the PI server.

       

      Best regards,
      Johan Fitié
      Vitens NV

        • Re: Set/remove Q-bit of tag values over timerange
          andreas

          Johan Fitié

          The only way I can think of is to use the SDK to read all the tags values in a PIData object, then changing the NamedValueQuestionable’ and then use UpdateValues to update all values on the server

           

          you already described the answer. Do you need some example for this in VB or C#?

            • Re: Set/remove Q-bit of tag values over timerange
              jfitie

              Hi Andreas,

               

               thanks for your reply. I was hoping for a better/more elegant solution requiring less resources. F.ex. some sort of UpdateValues function only (un)setting the Q-bit on all values over a timerange.

               

              Best regards,
              Johan Fitié
              Vitens NV

                • Re: Set/remove Q-bit of tag values over timerange

                  As Andreas' answer implied, there is no such solution at this time. However, I would like to invite you to contact our regular Technical Support team and file this is as an Enhancement Request. Describe the use case with as much precision as possible, and this will get considered/prioritized against other requests and bugs. You can refer to this discussion thread (http://vCampus.osisoft.com/forums/t/762.aspx) as a reference, when writing to Technical Support.

                    • Re: Set/remove Q-bit of tag values over timerange
                      vwitzel

                      Hi all,

                      I am trying to accomplish something similar to what Johan originally requested. Specifically, I am trying to get a count of questionable values for a tag over a given time range. I already have a VB.NET PI SDK code to do the following:

                       

                      1. Search for PI tags matching certain criteria
                      2. Loop through each tag returned by the search and
                        1. Retrieve its values over a predefined period of time
                        2. Count how many values there are over that period of time

                       

                      To determine the number of questionable values that exist over the same period of time, I was considering looping through each value, retrieving its ValueAttributes, storing these in a NamedValues object, and analyzing the results, but I'm wondering if there is a more efficient way to accomplish this. Appreciate any advice you can offer!

                      Thanks

                        • Re: Set/remove Q-bit of tag values over timerange
                          vwitzel

                          Update: While I struggled to use the PI SDK to implement the pseudocode in my previous message (specifically, looping through each value, retrieving its ValueAttributes, storing these in a NamedValues object, and analyzing the results), I found doing so significantly easier using the AF SDK (I started with the example code shown here). There may still be a more elegant way to determine the number of questionable values a tag has over a period of time than looping through all of its values, but for me, the AF SDK route did the trick. Hope that helps anybody who is looking to do something similar.