Topic
2 replies Latest Post - ‏2012-11-27T19:33:06Z by SystemAdmin
SystemAdmin
SystemAdmin
3180 Posts
ACCEPTED ANSWER

Pinned topic Determine top-level project for module nested in sub-project

‏2012-11-26T20:43:53Z |
We have a number of projects where sub-projects were used instead of folders, and I'm looking for a way to determine the top-most project using DXL. I'm going to be using that value to modify some attributes within the module. I've tried using getParentProject but I can't figure out how to go further up the project chain. I know it has to be something simple. Any help would be appreciated.
Updated on 2012-11-27T19:33:06Z at 2012-11-27T19:33:06Z by SystemAdmin
  • Mathias Mamsch
    Mathias Mamsch
    1734 Posts
    ACCEPTED ANSWER

    Re: Determine top-level project for module nested in sub-project

    ‏2012-11-26T22:55:13Z  in response to SystemAdmin

    Why not apply getParentProject recursively, e.g.:
     

    Project getRootProject (Item I) {
        Project p = getParentProject I 
        
        while (!null p && !null getParentProject item fullName p) p = getParentProject item fullName p
        return p 
    }
    

     


    I did not try/check the code, but I guess this should give you the idea. Hope that helps, regards, Mathias

     

     

     


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

     

     

    Updated on 2014-01-06T14:42:38Z at 2014-01-06T14:42:38Z by iron-man
  • SystemAdmin
    SystemAdmin
    3180 Posts
    ACCEPTED ANSWER

    Re: Determine top-level project for module nested in sub-project

    ‏2012-11-27T19:33:06Z  in response to SystemAdmin
    Thanks, that's exactly what I was looking for. An extra kudo for the fast response.
    BTW, these forums provide a great resource for folks like me. Thanks again!