eaUtils

Utilities add-in for Sparx Systems Enterprise Architect

Section 2. Sort elements from a Package or an Element by Alias

eautils sort by alias

This help article explains how to use eaUtils Sort By Alias feature on the elements that are contained within a package or element.

This feature runs from a package or an element, selected from the Project Browser (it can also be run on a package tree, click here for more information).

Example

The following diagram shows the elements defined in a package with a variety of alias values to illustrate the use of eaUtils Sort By Alias feature.

eautils sorting example

Using the alias field to sort elements

This feature lets you use the elements' Alias field to define their sorting order within a package or element.

Sort elements within a package by alias

Option 1: default settings

Select the package where elements need to be sorted > Extensions > eaUtils > Project Browser: sort elements by alias.

 

Confirm that you would like to proceed from the following dialog window:

(Note: eaUtils sort by settings are displayed. eaUtils Settings can be opened from this windows should they need to be modified).

eautils addin sort by alias in sparx enterprise architect

Once the sorting is complete, the following window is displayed:

 

The expected result is illustrated below (note that the option "Identify and sort integers within string values" is enabled by default).

Name Alias
Actor2 1
Actor1 3
Actor3 4
Actor4 UC-1-Test
ActorB UC-3-Test
ActorC UC-12-Test
ActorA UC-29-Test
Use Case0  
Use Case1  
Use Case2 1
Use Case3 2
Class2  
Class4  
Class1 9
Class3 10
Interface3  
Interface2 5
Interface1 20
Requirement09  
Requirement10  
Requirement11  
Requirement12  
Requirement12  
Requirement9  
Requirement5 1
Requirement7 12
Requirement6 13
Requirement8 25
Requirement1 REQ1
Requirement2 REQ4
Requirement3 REQ12
Requirement4 REQ45

The new sorting order is visible in Enterprise Architect project browser as illustrated below:

eautils sort by alias sparx ea project browser result

Option 2: "Identify and sort integers within string values" setting disabled

When the option "Identify and sort integers within string values" is disabled in eaUtils settings, there is no attempt to extract integer values and sort them accordingly. Based on the previous data set, disabling this option will impact use cases with UC-x-Test alias values, and requirements with REQx values:

  • The expected order for the use cases is UC-1-Test, UC-12-Test, UC-29-Test, UC-3-Test,whereas the previous result with this option enabled by default was UC-1-Test, UC-3-Test, UC-12-Test, UC-29-Test.
  • The expected order for the requirements is REQ1, REQ12, REQ4, REQ45, whereas the previous result was REQ1, REQ4, REQ12, REQ45.

The expected result is illustrated below. Note that ActorC with alias "UC-12-Test" is placed before Actor4 with alias "UC-1-Test" due to a constraint in the sorting method used in C#.

Name Alias
Actor2 1
Actor1 3
Actor3 4
ActorC UC-12-Test
Actor4 UC-1-Test
ActorA UC-29-Test
ActorB UC-3-Test
Use Case0  
Use Case1  
Use Case2 1
Use Case3 2
Class2  
Class4  
Class1 9
Class3 10
Interface3  
Interface2 5
Interface1 20
Requirement09  
Requirement10  
Requirement11  
Requirement12  
Requirement12  
Requirement9  
Requirement5 1
Requirement7 12
Requirement6 13
Requirement8 25
Requirement1 REQ1
Requirement3 REQ12
Requirement2 REQ4
Requirement4 REQ45

The new sorting order is visible in Enterprise Architect project browser as illustrated below:

eautils sort by alias sparx ea project browser result

Option 3: Use the Case Sensitive Value setting

eaUtils can be set as case sensitive on the values.

This can be useful when you need to treat values like "Requirement1, requirement2, REQUIREMENT3, requirement4, Requirement5" as within the same list or not. When making eaUtils case sensitive, the previous list will be sorted as follows: "requirement2, requirement4, Requirement1, Requirement5, REQUIREMENT3".

Option 4: Sort numbering sequences setting (eaUtils 1.12)

The following diagram illustrates a package content which alias need to be sorted using eaUtils Sort numbering sequences option.

eautils sort by sequence numbers alias browser

When enabled, this option leads to the following result in the project browser:

Sort elements within an element by alias

When an element contains itself elements, e.g. a UML activity or use case contains activities, nodes, etc., these elements can be sorted with eaUtils addin.

Option 1: default settings

Select the element which embedded elements need to be sorted > Extensions > eaUtils > Project Browser: sort elements by alias.

sort elements in a composite element by alias

Confirm that you would like to proceed:

The expected result is illustrated below (note that the option "Identify and sort integers within string values" is enabled by default).

Name Alias
Activity2 ACTIVITY1
Activity3 ACTIVITY4
Activity1 ACTIVITY10
Start  
end  
option enabled?  

Once confirmed, the elements are sorted as illustrated below, matching the above expected results:

eautils sort by alias sparx ea project browser result

Option 2: "Identify and sort integers within string values" setting disabled

When the option "Identify and sort integers within string values" is disabled in eaUtils settings, there is no attempt to extract integer values and sort them accordingly.

The expected result is illustrated below.

Name Alias
Activity2 ACTIVITY1
Activity1 ACTIVITY10
Activity3 ACTIVITY4
Start  
end  
option enabled?  

Once confirmed, the elements are sorted as illustrated below, matching the above expected results:

eautils sort by alias sparx ea project browser result

Last modified on Tuesday, 14 March 2017 08:16