Book a Demo

Author Topic: Maintaining Element creation order  (Read 3475 times)

bsd103

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Maintaining Element creation order
« on: January 23, 2013, 08:21:57 am »
For an add-in I am working on, I am generating many elements for which ordering in the model is important.  The default behavior however, is that all the elements in a given package are sorted alpha-numerically.  Is there some way I can override this behavior (or at least force elements into a certain order)?  My goal is to maintain the order in which the elements are created in code.
« Last Edit: January 23, 2013, 08:23:24 am by bdoherty103 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Maintaining Element creation order
« Reply #1 on: January 23, 2013, 06:32:14 pm »
There are a few options that deal with the order in the project browser.

Further you'll need to use the Package.TreePos, Element.TreePos, Attribute.Pos, Method.Pos  properties to influence project browser order.

Come to think of it, I haven't found a TreePos property for Diagrams, although it is possible to change their order in the project browser.

I'll have a look under the hood then..

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Maintaining Element creation order
« Reply #2 on: January 23, 2013, 07:22:50 pm »
The column t_Diagram.TPos controls the project browser order for diagrams, but that column hasn't been exposed in the API.

If you need it you'll need to send a Feature Request to expose that field.

In the meantime you could change it in the database directly with an sql update query using Repository.Execute()

Geert

bsd103

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Maintaining Element creation order
« Reply #3 on: January 24, 2013, 01:12:08 am »
Thanks that worked brilliantly.  I did run across Treepos but I wasn't sure of it's purpose with the lack of documentation...