Book a Demo

Author Topic: Simple search using GUID?  (Read 8932 times)

ken.norcross

  • EA User
  • **
  • Posts: 63
  • Karma: +0/-0
    • View Profile
Simple search using GUID?
« on: August 22, 2014, 03:10:02 am »
Maybe I just can't find it, but I don't see an easy way to do a simple search for an element using the GUID.

I am trying to chase down which elements are impacted by the "cross package reference" warning when you commit changes to a VCS.

The warning dialog only gives you GUIDs, and I want to investigate further, but I see no easy way to search for an element based on the GUID.

I will write a quick script in the meantime, but surely there must be a direct way using the workbench?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Simple search using GUID?
« Reply #1 on: August 22, 2014, 03:45:33 am »
The XML guids are formatted different to that inside EA. Just from memory the "-" is replaced by "_", there's a different prefix and the enclosing curly braces are omitted. Just have a look at one GUID in t_object.

q.

ken.norcross

  • EA User
  • **
  • Posts: 63
  • Karma: +0/-0
    • View Profile
Re: Simple search using GUID?
« Reply #2 on: August 22, 2014, 04:07:50 am »
I use jscript for scripting, and using an api like this:

element = Repository.GetElementByGuid("{857C6B87-0EC2-45cc-A50E-34D931E1E26F}");

I can find elements using GUIDs I exported into a csv file using script like this:

element.ElementGUID

But the warning dialog gives me GUIDs that look like this:

EAID_B9C372CD_949E_4822_BA2C_3F018B8DE172
or
EAPK_E3EFAB06_0978_4623_AD90_FF38994AEEFE

I am dropping the prefix (EAID_ or EAPK_) and enclosing the rest in {}, but my script does not find any elements with those GUIDs.

Now it may be actually true that these elements are not in the model, since I am checking after my commit and warning, but the warning was about sparx removing a relationship and I am trying to find the source and destination elements for the relationship mentioned in the warning so I would expect them to still be in the model.

Next time I have a warning I will cancel and try to find the elements before I commit, and see if I can get this script to work with the GUIDs they show to me in the warning dialog.


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Simple search using GUID?
« Reply #3 on: August 22, 2014, 06:44:19 am »
You also need to replace the "_" by "-".

Also be aware that a guid can be from a diagram, package, attribute or operation too.

q.
« Last Edit: August 22, 2014, 06:46:06 am by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Simple search using GUID?
« Reply #4 on: August 22, 2014, 04:05:11 pm »
Ken,

I've implemented such a search fucntion in my free EA Navigator add-in.
It doesn't only search for elements but also diagrams, attributes, operations and connectors.

Geert