2 Replies Latest reply on Oct 10, 2014 9:42 PM by Wenpeng Yu

    How to use ChildReferenceType of AFElementTemplate in AFSDK or "PI System Explorer ?

    Wenpeng Yu

      In PI AFSDK, AFElementTemplate has an attribute "ChildReferenceTypes", but this attribute is read only.  Similarly, in "PI System Explorer", we can not create child element template or reference child template. Then here are 2 questions:


      1) Since we can not add child in the template level, what is the attribute "AFElementTemplate.ChildReferenceTypes" used for ?  Does "ChildReferenceTypes" remains empty ?


      2) An element can take instances of any template as children or reference children, is it true?

        • Re: How to use ChildReferenceType of AFElementTemplate in AFSDK or "PI System Explorer ?

          This property reflects the reference types that are possible to use from the current element template (or one of its base templates) when adding child elements.  That list is composed by looking at the existing reference types defined in the AF Database.


          In AF SDK, you add to this property by creating new reference types with specific Parent Templates and Child Templates.


          In PSE, you can add the same way, but it is much simpler to right-click New/Referenced Template (or New/Add Referenced Template) from an existing template.  


          1) The property takes care of navigating the reference types, as well as the template inheritance chain, to determine exactly which reference types are identified are appropriate as children.  In PSE, you see the result of this collection anytime you do "New Child Element".  The "Reference Types"  shown are from this list.


          2) There are some included reference types (Parent-Child for example) which do not limit the parent/child, so, it is usually possible to add an element using one of the non-specific reference types.  By default, PSE will attempt to direct users to  use the most specific reference types when they exist.  Note that you can also arrange your Element Templates by Reference Type, making it much simpler to see how element templates can be instantiated into a hierarchy.