Forum Discussion

abdul_rp's avatar
abdul_rp
Contributor
13 years ago

How to get the hierarchy of the individual objects from the Aliases


Hi,



I am able to get the individual Object name from the following

code from Namemapping.



How to get the hierarchy of the individual object from Aliases?



Sub
GetNextAlias(AliasObject)


    Dim iteratorProperties


    Dim iteratorProp


 


    Set iteratorProperties = aqObject.GetProperties(AliasObject)


    


    While iteratorProperties.HasNext  


        Set iteratorProp = iteratorProperties.Next


        'ValueType 29 appears to correspond with other objects from the name mapping or alias trees


        If (iteratorProp.ValueType = 29) Then


                Log.AppendFolder(iteratorProp.Name)


                GetNextAlias(aqObject.GetPropertyValue(AliasObject,iteratorProp.Name))


                Log.PopLogFolder


        End If


    Wend


   


End Sub


 


Sub test()


     Log.AppendFolder("Name Mapping")


     Call GetNextAlias(NameMapping.Sys)


     Log.PopLogFolder


     Log.AppendFolder("Aliases")


     Call GetNextAlias(Aliases)


     Log.PopLogFolder


End Sub



Regards,

Abdul


  • Hi All,



    I have found a solution for the question I have raised.



    Sub GetNextAlias(AliasObject,Parent)


        Dim iteratorProperties


        Dim iteratorProp


     


        Set iteratorProperties = aqObject.GetProperties(AliasObject)


        


        While iteratorProperties.HasNext  


            Set iteratorProp = iteratorProperties.Next


            'ValueType 29 appears to correspond with other objects from the name mapping or alias trees


            If(iteratorProp.ValueType = 29) Then


            Log.AppendFolder(iteratorProp.Name)


           '' MsgBox(iteratorProp.Type)


             Hierarchy = Parent&"."&iteratorProp.Name


             Temp = "Var" & iteratorProp.Name &" = " & Hierarchy


             Call LogText(Temp)         


             Call GetNextAlias(aqObject.GetPropertyValue(AliasObject,iteratorProp.Name),Hierarchy)


            Log.PopLogFolder         


            End If


        Wend


       


    End Sub


     


    Sub test()


         Log.AppendFolder("Aliases")


         If(aqFile.Exists(sPath)) Then


         aqFile.Delete(sPath)


         End If


          


         Call GetNextAlias(Aliases.Sys,"Aliases.Sys")


         Log.PopLogFolder


    End Sub



    Regards,

    Abdul