Book a Demo

Author Topic: FindObject method from Package class  (Read 4209 times)

Pedro

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
FindObject method from Package class
« on: March 26, 2014, 05:49:23 am »
Hello,

I have a Package hierarchy in a given model. I'm trying to use the p.FindObject(dottedID) method to get a reference for a desired package in that hierarchy.

I'm obtaining the dotted IDs directly from EA by right click -> copy reference -> copy Node path to clipboard.

Every time I got the same error: Can't find matching object.

Please, advise. My current code:

 
Code: [Select]
Repository r = new Repository();
            r.OpenFile(projectPath);

            foreach (Package m in r.Models)
            {
                foreach (var name in packageList)
                {
                    var a = m.FindObject(name);
}
}

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: FindObject method from Package class
« Reply #1 on: March 26, 2014, 10:48:55 am »
Why don't you use Copy/GUID and use Repository.GetElementByGUID(guid)?

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: FindObject method from Package class
« Reply #2 on: March 26, 2014, 05:37:05 pm »
I'm not sure if that operation really works, I've never used it anyway.
I did however implement my own operations to select something based on a fully qualified name, and based on a GUID.
Both are Implemented in the EA Navigator
The code is available on Github

Geert