Book a Demo

Author Topic: Jump directly to column from search  (Read 3236 times)

Yves Mulkers

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Jump directly to column from search
« on: November 20, 2015, 05:35:22 pm »
I need some help navigating to columns from search in EA.

I'm charged with renaming columns that have a typo.

Now I use the extended search to find the incorrect column names.
But the search just shows the entities, then I need to open the entity, go to table details, go to columns, and browse (eyeballing) to find the column.

Is there an easier way, so I could just have the incorrect column names shown in the search results and rename them from there.
Any option the reduce the number of steps to be take, are most welcome.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Jump directly to column from search
« Reply #1 on: November 20, 2015, 05:59:50 pm »
Hi Yves,

You can achieve this by writing an SQL search of your own.

Columns are stored as attributes in EA, so you'll have to write your query against the t_attribute table.
In SQL queries there are two "magic" columns, the CLASSGUID and the CLASSTYPE. These two will not show up, in the results, but they allow EA to show the right icon and allow you to doubleclick or select the thing in the project browser.

Something like this could work

Code: [Select]
select a.ea_guid AS CLASSGUID,'Attribute' AS CLASSTYPE,a.name as Name, a.Type as Type, o.[Name] as ClassifiedType,  o.name as ClassName
,package.name as Package ,package_p1.name as Pakckage_L1 ,package_p2.name as Package_L2 ,package_p3.name as Package_L3
from ((((((t_attribute  a
inner join t_object o on a.object_id = o.object_id)
inner join t_package package on o.package_id = package.package_id)
left join t_object o on  o.[Object_ID] = a.[Classifier] )
left join t_package package_p1 on package_p1.package_id = package.parent_id)
left join t_package package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package package_p3 on package_p3.package_id = package_p2.parent_id)
where a.Name like '#WC#<Search Term>#WC#'
and o.Package_ID in (#Branch#)

This search will find all attributes in the currently selected package tree with a given name. The #WC# tags are equivalent to the wildcard % in SQL.
If you rather type your wildcards yourself then you can omit those.
The and o.Package_ID in (#Branch#) statement takes care of the "in the selected package tree" part.
If you want to search the whole model then leave that part out.

Geert
« Last Edit: November 20, 2015, 06:07:49 pm by Geert.Bellekens »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Jump directly to column from search
« Reply #2 on: November 20, 2015, 06:07:33 pm »
On the other hand, if it is just renaming a typo in a column I would write a quick fix script and execute that.

Code: [Select]
option explicit

sub main
      dim sqlUpdate
      sqlUpdate = "update t_attribute set name = 'CorrectName' where name = 'WrongName' and stereotype = 'column'"
      Repository.Execute sqlUpdate
end sub

main

Bam, fixed in 0.1 seconds  :D

Just make sure you have a backup before you attempt things like this. You can easily destroy your whole model :o

Geert