Book a Demo

Author Topic: Repository.getElementSet  (Read 7093 times)

christian81

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Repository.getElementSet
« on: February 12, 2011, 02:54:11 am »
hi there,

how can i use this funcion if i want to get all available models in a repository?

i guess to use a list of id´s don´t help me because i don´t know how much models are available.

Thx


stao

  • EA User
  • **
  • Posts: 137
  • Karma: +0/-0
    • View Profile
Re: Repository.getElementSet
« Reply #1 on: February 12, 2011, 11:31:03 pm »
Code: [Select]
foreach(EA.Package actModel in Repository.Models)
{
   ....
}


should be do what you want.

christian81

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Repository.getElementSet
« Reply #2 on: February 17, 2011, 08:58:35 pm »
thx for your answer.

if i want to use this code in VBA i should use

Code: [Select]

For each Pack In Repository.Models
{

}


right?

But actually i really want to now what this funcion Repository.getElementSet() is doing.

I found the description in the help directory:

" ....Returns a set of elements as a collection based on an input of element ID numbers in comma separated form. eg. GetElementSet("34,56,21,5").... "

Should i put this function in a loop in order to get a collection of these ID numbers? How it works?

Thx


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.getElementSet
« Reply #3 on: February 17, 2011, 09:14:10 pm »
GetElementSet can be used when you already know the id's of the elements you need, but you don't have the actual EA.Element objects yet.
(you can also pass an sql string to get those id's)

Geert

christian81

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Repository.getElementSet
« Reply #4 on: February 18, 2011, 12:30:38 am »
If i know the id´s of elements. how it´s work then...

Code: [Select]

Dim coll as New Collection
Dim i as integer

for i = 0 to 2
{
     coll.add item:=Repository.getElementSet("71,81,169",1)
}


i guess this kind of code is not the right thing...

thx

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.getElementSet
« Reply #5 on: February 18, 2011, 12:45:56 am »
Repository.GetElementSet already returns a collection.
I don't see why you would request that multiple times.

May I ask what exactly you are trying to achieve?

Geert

christian81

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Repository.getElementSet
« Reply #6 on: February 18, 2011, 01:08:25 am »
oh no... you are right.. the return value is a collection...

I want to find out the easiest way to get all available elements in a repository. Is this the right way to use  this function?


Mycollection = Repository.getElementSet("71,81,169",1)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Repository.getElementSet
« Reply #7 on: February 18, 2011, 01:18:40 am »
Looks like a correct usage of getElementSet

Geert

christian81

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Repository.getElementSet
« Reply #8 on: February 18, 2011, 01:48:25 am »
now i got this....

Code: [Select]

Dim testCon as New collection

    Set MyCollection = Repository.GetElementSet("71,81,169", 1)

    For Each Item In MyCollection
    
         testCon.Add Item:=Item
    
    Next