Eventframe Root Objects vs Child Objects and references.

When I create a child event frame in PI System Explorer, it defaults to being a "proper" child, creating an object that sits under the parent. If I create an event frame using the AFSDK, and add it as a child of another event frame, it defaults to being an object created at the root level, and it is associated with the other event frame as a child.

 


EventFrameComparison.png
Eg - you can see that the "Child via SDK" has the icon indicating it is added as a reference object; the "ChildFrame vis PSE" does not.

Now: I know that I can enforce the newly-created EventFrame in the SDK to be a child by setting the IsRoot property:

EventFrame = new AFEventFrame(database, Name, EventFrameTemplate);
if (parent != null)
{
    Parent.EventFrames.Add(EventFrame);
    EventFrame.IsRoot = false;
}

I am not trying to do anything like a 1:many (setting one event frame to be the child of many others). Whether I set the IsRoot = false or not, everything 'works' - I can quite happily enumerate the Parent.EventFrames collection, and the Eventframe can be accessed.

My question is really whether there is a technical reason as to whether one approach is better than the other? For example, does one approach lead to better (or worse) search performance for event frame searches?

My preference is to set the IsRoot = false and have the objects set as child objects, mainly because it seems tidier in my mind, but ultimately the technical considerations should take precedence over 'aesthetics'.

Parents
  • Just a comment on how you create then link the EF's through code:

     

    Your first line creates a new EF on the root level, then you add it to an existing EventFrames collection on line four. If you want to create it directly on the child level, make sure you combine the two operations. I.e. use one of the overload methods of the EventFrames class to create the EF directly. The way you're doing it now first creates it (on the root level), then you add a reference to it on the child level. By creating it directly using the correct overload of Parent.EventFrames.Add(...), it should be created the correct place

     


    image.png

  • Thank you! I'd looked at the overloads, particularly the ones that allowed you to pass an AFReferenceType parameter, but hadn't noticed that this or the others create a new Event Frame!

Reply Children
No Data