Print this page

Section 3. Sort elements from a Package or an Element by Tagged Value

eautils sort by tagged value

This help article explains how to use eaUtils Sort By Tagged Value feature on the elements that are contained in a package or element. By default, eaUtils sorts elements according to the "BrowserOrder" Tagged Values. Settings introduced in eaUtils 1.11 make it possible to change the name of the Tagged Value, e.g. "element id" or anything else.

This feature runs on 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 "BrowserOrder" tagged values to illustrate the use of eaUtils Sort By Tagged Value feature.

eautils sorting example

Using the predefined BrowserOrder or a custom tagged value to sort elements (eaUtils settings)

This feature uses the dedicated Tagged Value BrowserOrder value to sort elements within a package or element. eaUtils settings lets you define when needed a different Tagged Value other than "BrowserOrder" (introduced in version 1.11).

Sort elements within a package by tagged value (BrowserOrder)

Option 1: default settings

Right click in the Project Browser on the package where elements need to be sorted > Extensions > eaUtils > [Browser] Sort elements.

sparx enterprise architect sort elements in browser addin 

In the following dialog window, select Tagged Value as the sorting option and confirm that you would like to proceed with the default 'BrowserOrder' tag.

Note: eaUtils sort by settings are displayed. The settings can be opened and modified if needed.

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

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

Name BrowserOrder Tagged Value
Actor4  
ActorA  
ActorB  
ActorC  
Actor3 4
Actor1 5
Actor2 5
Use Case0  
Use Case2  
Use Case3 1
Use Case1 10
Class1  
Class4 1
Class3 6
Class2 10
Interface2  
Interface1 3
Interface3 20
Requirement09  
Requirement6  
Requirement7  
Requirement8  
Requirement12 1
Requirement12 2
Requirement11 12
Requirement1 REQ-1
Requirement2 REQ-02
Requirement3 REQ-5
Requirement4 REQ-25
Requirement5 REQ-100
Requirement10 REQ-9-TEST
Requirement9 REQ-60-TEST

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

eautils sort by tagged value 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, this option will impact requirements with REQx values:

  • The expected order for the requirements is REQ-02, REQ-1, REQ-100, REQ-25, REQ-5, REQ-60-TEST, REQ-9-TEST, whereas the previous result with this option enabled by default was REQ-1, REQ-02, REQ-5, REQ-25, REQ-100, REQ-9-TEST, REQ-60-TEST.

The expected result is illustrated below.

Name BrowserOrder Tagged Value
Actor4  
ActorA  
ActorB  
ActorC  
Actor3 4
Actor1 5
Actor2 5
Use Case0  
Use Case2  
Use Case3 1
Use Case1 10
Class1  
Class4 1
Class3 6
Class2 10
Interface2  
Interface1 3
Interface3 20
Requirement09  
Requirement6  
Requirement7  
Requirement8  
Requirement12 1
Requirement12 2
Requirement11 12
Requirement2 REQ-02
Requirement1 REQ-1
Requirement5 REQ-100
Requirement4 REQ-25
Requirement3 REQ-5
Requirement9 REQ-60-TEST
Requirement10 REQ-9-TEST

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

eautils sort by tagged value sparx ea project browser result

Option 3: Use the Case Sensitive Value setting

eaUtils can be case sensitive on the values depending on eaUtils Settings choice.

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

Option 4: Sort numbering sequences setting

The following diagram illustrates a package content which BrowserOrder tagged value needs to be sorted using eaUtils Sort numbering sequences option.

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

 

Option 5: sort sub elements

Introduced in eaUtils 1.14, the "process sub elements" sorting setting is available so that not only elements within the selected package are sorted, but also elements placed within elements of that package.

With the current example model, running the sort by tagged value with the sub elements setting enabled makes it possible to sort elements within the selected package, as well the the elements within the composite use case (Use Case0), illustrated in the next section.

Sort elements within an element by tagged value BrowserOrder

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

Right click in the Project Browser on the element with embedded elements to be sorted > Extensions > eaUtils > [Browser] Sort elements.

In the following dialog window, select Tagged Value as the sorting option and 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 BrowserOrder Tagged Value
Activity3 TEST01
Activity1 TEST2
Activity2 TEST12
Start  
end  
option enabled?  

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

eautils sort by tagged value 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 BrowserOrder Tagged Value
Activity3 TEST01
Activity2 TEST12
Activity1 TEST2
Start  
end  
option enabled?  

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

eautils sort by tagged value sparx ea project browser result