6 Replies Latest reply on Jan 22, 2015 10:06 AM by florianr

    Using PIUniqueID to identify Object

    florianr

      Hi!

       

      I am writing an application which stores information connected to PIUnitBatches (in future probably EventFrames) in an external SQL Database.

       

      Can I savely use PIUniqueIDs to identify the batches or do they change under certain circumstances?

       

      Thank you in advance!

        • Re: Using PIUniqueID to identify Object
          dng

          The PI Batch Database stores data as follow:

          When a PIModule is marked as a unit, the Base Subsystem automatically creates a point with a tag name that equals the GUID of the module. This point is where all unit batch and sub-batch data for this unit will be stored in the archive.

          The PIUnit Point stores the GUID for each PIUnitBatch, with the event time = start time of the PIUnitBatch and event value = UniqueID of the PIUnitBatch.

           

          With that said, it might be safer to say that the combination of the PIUnit GUID + PIUnitBatch GUID will point to a unique PIUnitBatch.

          Regarding whether these GUIDs will change, no users should ever manage these points directly. Unfortunately, the PI Server does not yet have the notion of "private" or "protected" points (or other configuration); thus, we have no way of protecting against external modification. E.g. if the PIUnitBatches were deleted and recreated, I believe these GUIDs will change.

           


          1 of 1 people found this helpful
            • Re: Using PIUniqueID to identify Object
              Dan Fishman

              Daphne seemed to nail it! 

               

              PI UnitBatch objects have a UniqueID property and this ID never changes and you never want to touch these internal tags.  Ever.

               

              The PIUnitBatch GUID can be used to look up the module.  Recall, you really look up PI Units based on modules.  The most efficient search is to specify the module and provide the GUID of the Unit Batch and not have to go through the annotations.

               

              Yeah, EF have GUIDS as well.  More to play with in the future for you!

              1 of 1 people found this helpful
                • Re: Using PIUniqueID to identify Object
                  florianr

                  Okay, so I can use module+GUID to identify an Unit Batch.

                  Thanks to both of you. This is exactly what I wanted to know.

                   

                  Do you know what's the situation with Event Frames?

                    • Re: Using PIUniqueID to identify Object
                      Dan Fishman

                      Florian,

                      Just to be clear you can identify a Unit Batch by its UniqueID; however, it it s faster to know the module where it came from.  There is no need for the PIUnit GUID unless you want find it faster.

                       

                      Regarding PI Event Frames, every EF has a GUID (uniqueID) associated with it.  There is a Static method FindEventFrames that takes a PISystem object and a Guid.  You can obtain the UniqueID (string) or ID (GUID) of an EF object.  Seems pretty simple. 

                       

                      Regards,

                      Dan

                      1 of 1 people found this helpful
                        • Re: Using PIUniqueID to identify Object
                          dng

                          Hi Florian,

                           

                          Yep! As Dan has mentioned, you can use the GUID for the Event Frames to uniquely identify the Event Frame object. In fact, the ID can be used to uniquely identify all objects in AF. If you look at the AFSDK Reference:
                          "The ID property uniquely identifies an object across all databases. The ID is assigned when the object is created. This property can be used as the key when referencing the object in a collection using the Item property with a Guid parameter value."

                          1 of 1 people found this helpful