Book a Demo

Author Topic: Search through repository based on type  (Read 4258 times)

sravang

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Search through repository based on type
« on: November 10, 2020, 10:38:34 pm »
Hello,

I have a huge repository with many packages and elements. Is there any way I can filter out elements in my repository based on type. I have tried GetElementsByQuery but is not the way I want search because it involves you to create search in sparx ui .I want to filter them out in add-in code. Also is there any way to traverse through repository tree faster. The repository I am working is around 800 mb and it takes me around 2 hours to process through repository. Is there any easier way to traverse repository faster.

Thanks

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Search through repository based on type
« Reply #1 on: November 10, 2020, 11:04:36 pm »
Repository.GetElementSet(myQuery,2)

Geert

sravang

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Search through repository based on type
« Reply #2 on: November 10, 2020, 11:35:55 pm »
Hello,

I have just used basic query to try this out.

         string SQLSearchString = "select Object_Type from t_object";

         logger.DebugFormat("searchtermsql -- {0}", SQLSearchString);


         EA.Collection test;
          test = repository.GetElementSet(SQLSearchString, 2);

When I try to run this I get an error "Item not found in collection" multiple times.

Thanks,

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Search through repository based on type
« Reply #3 on: November 10, 2020, 11:48:23 pm »
GetElementSet needs the ObjectID as first in the result row.

q.

sravang

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Search through repository based on type
« Reply #4 on: November 11, 2020, 01:48:48 am »
Thanks I'll work on it.
Is there any way to traverse through repository in faster way.

Thanks,

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Search through repository based on type
« Reply #5 on: November 11, 2020, 03:10:51 am »
Not really. Using a SQL (like here) is the fastest way. However, GetElementSet fetches the whole EAElement and constructs the object. If you need only certain columns a repository.SQLQuery is even faster.

q.
« Last Edit: November 11, 2020, 03:12:40 am by qwerty »