Main Content

getParent

Get parent element of AF element

Since R2026a

    Description

    parentElement = getParent(elementObj) returns parent elements of the AF element specified by elementObj.

    example

    parentElement = getParent(elementObj,ReferenceStrength=strengthType) returns the parent elements whose relationship with afElementObj is of the type specified by strengthType.

    To get parent attribute of a specific AF attribute, use getParent.

    Note

    You must install the AF SDK library to connect to a PI AF server from MATLAB®. For more information, see AF SDK Overview.

    example

    Examples

    collapse all

    Create an AF client associated with the default database of the server and find an element in the database.

    afclientObj = afclient("EVS-Hydroplant");
    guElement = findElementByName(afclientObj,"GU3 Generator");

    Retrieve parent element of the specified the AF element.

    parentElement = getParent(guElement)
    parentElement = 
    
      Element with properties:
                 Name: "GU3"
                 Path: "\\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn II\GU3"
             Database: "OSIDemo_PG_HydroPlant"
           Categories: ""
             Template: "GenerationUnit"
          Description: ""
          NumChildren: 2
        NumAttributes: 30

    Create an AF client associated with the default database of the server and find an element in the database.

    afclientObj = afclient("EVS-Hydroplant");
    guElement = findElementByName(afclientObj,"GU1 Generator");

    Retrieve parent elements of the specified AF element.

    parentElements = getParent(guElement)
    parentElements = 
    
      1×3 Element array:
        Index  Name                                 Path                                   NumChildren
        -----  ----  --------------------------------------------------------------------  -----------
          1    GU1   \\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn I\GU1        3
          2    GU2   \\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn I\GU2        3
          3    GU3   \\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn II\GU3       3

    Retrieve the tightly linked parent of the element.

    strongParent = getParent(guElement,ReferenceStrength="Strong")
    strongParent = 
    
      Element with properties:
                 Name: "GU1"
                 Path: "\\VDI-BGLWDP-192\Database2\Flynn River Hydro\Flynn I\GU1"
             Database: "Database2"
           Categories: ""
             Template: "GenerationUnit"
          Description: ""
          NumChildren: 3
        NumAttributes: 56

    Input Arguments

    collapse all

    AF element, specified as an icomm.af.Element object. You can use findElementByName, findElementByPath, or findElementByTemplate to create an icomm.af.Element object or array of AF element objects.

    Reference strength value, specified as one of these strings:

    • "All" — The function returns all parent elements of the specified AF element.

    • "Strong" — The function returns only the parent elements with the reference type Parent-Child.

    • "Composition" — The function returns only the parent elements whose relationship with the specified AF element is of reference type Composition.

    • "Weak" — The function returns only the parent elements whose relationship with the specified AF element is of reference type Weak Reference.

    Data Types: char | string

    Output Arguments

    collapse all

    Parent elements of the input AF element, returned as an icomm.af.Element object or an array of icomm.af.Element objects. For more information, see AF Element Properties.

    Version History

    Introduced in R2026a