Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: AdamK on November 21, 2012, 11:20:28 pm

Title: Sort the attributes of class
Post by: AdamK 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!
Title: Re: Sort the attributes of class
Post by: Geert Bellekens on November 22, 2012, 12:06:24 am
Use EA.Attribute.Pos

Geert
Title: Re: Sort the attributes of class
Post by: AdamK on November 22, 2012, 01:31:22 am
Thanks Geert! You've been very helpful!!
Title: Re: Sort the attributes of class
Post by: tanja 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...