4 Replies Latest reply on Jul 1, 2015 2:21 PM by mdspath

    Is date / time of when Pi Archive started?

    mdspath

      Hello:

      I'm using the AF SDK to develop custom interfaces to our Pi Server, normally, we have the user enter start and end dates that they are interested in to narrow the search window. I've been asked to give them to the option to find tag values (for a set of tags) from the "birth" of the pi archive until until now (*).

      I can have a timedate in an external database we use for configuration but I was wondering if there was a call tot eh AF SDK I could use.

      Thanks,

      Mike

        • Re: Is date / time of when Pi Archive started?
          Dan Fishman

          There is no PI AF SDK or PI SDK call to obtain an archive start and end date.  I believe our powershell tools can obtain the archive start and end dates.

          1 of 1 people found this helpful
          • Re: Is date / time of when Pi Archive started?
            dng

            Hi Mike,

             

            As Dan said, there are no SDK calls to obtain the start date of the archive. The main focus of the SDKs is "data access" instead of "system management". For more information, I encourage you to check out this previous discussion here: PI Archive Start Time.

             

            There are several ways you can accomplish what you are looking for:

            • Use AFTime.MinValue as the start time (1/1/1970). Note that there is a known issue and you'll have use a start time slightly after AFTime.MinValue for your query.
            • Use the timedate in your external database.
            • Use powershell or command line utilities to query for the start time.
            • Use the SDK to query for the tag creation date. Note that this will not work if you have backfilled data prior to the creation date.
            • Use the SDK to query for the timestamp of the first archived value for the tag. This requires more work but will work with backfilled data prior to the creation date.
            1 of 1 people found this helpful
            • Re: Is date / time of when Pi Archive started?
              Rhys Kirk

              Maybe you do a crafty PE to get the first event for a given PI Point? A PI Point may not even exist in historical archives so finding it's first value is probably more useful to you. Otherwise stick to 1970 as the first possible date?

               

              NextEvent('Tag','01-01-1970 00:00:00')

               

              Or something along those lines.

              1 of 1 people found this helpful
              • Re: Is date / time of when Pi Archive started?
                mdspath

                Thanks all for your quick responses, I think I'll go with the timestamp we will put into our external dB