Author Topic: Sort the attributes of class  (Read 4314 times)

AdamK

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Sort the attributes of class
« on: November 21, 2012, 11:20:28 pm »
Hello,

In my add-in, I need to copy all the attributes from class A to class B. However, the order of attributes of B displayed in the diagram is alphabetic rather than the same order of attributes of class A.

Is there a way to display the attributes of class B with the same order as attributes of class A?

Thanks!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Sort the attributes of class
« Reply #1 on: November 22, 2012, 12:06:24 am »
Use EA.Attribute.Pos

Geert

AdamK

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Sort the attributes of class
« Reply #2 on: November 22, 2012, 01:31:22 am »
Thanks Geert! You've been very helpful!!

tanja

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Re: Sort the attributes of class
« Reply #3 on: December 21, 2012, 10:08:48 pm »
Quote
Use EA.Attribute.Pos

Geert

Yes, but ensure you do your own checks because you can have situations like this in EA - logged from my programme:
Code: [Select]
[main] ERROR [+++ EA problem: attr count on MyClass = 3
,    +++ attr [0] name = value, pos = 0
,    +++ attr [1] name = normaIlyInService, pos = 1
,    +++ attr [2] name = curveStyle, pos = 0
]
This may happen when you do drag/drop of attributes from the project browser onto the class in a diagram, to have multiple attributes with the same value in Pos.
I've filed the issue officially (registered user) very loooong time ago, but this still may happen with EA 9.3...