Author Topic: Get Element by Name  (Read 1652 times)

peter.zrnko

  • EA User
  • **
  • Posts: 253
  • Karma: +0/-0
    • View Profile
Get Element by Name
« on: May 05, 2008, 08:10:24 pm »
What's the best way to get an element (class) by it's name using automation interface?

I've found this
For example GetElementsByQuery('Simple','Class1'), where results contain elements with Class1 in the Name and Notes fields.
in the help.

Isn't it possible to use collection of elements and getByName()? But I didn't found any collection of all elements in a Repository (Project).
Peter

brannstrom

  • EA User
  • **
  • Posts: 35
  • Karma: +0/-0
    • View Profile
Re: Get Element by Name
« Reply #1 on: May 05, 2008, 08:45:14 pm »
I would use sql directly on the database.  

SELECT Object_ID FROM t_object WHERE Name = 'elementName'

When I just want to find objects I almost always use sql. The ability to write more advanced queries with sql saves me a lot of execution time. But I try to use the automation interface when setting values.

/N