Monday, 29 August 2016 12:57

Generic element Auto counter

Written by
Rate this item
(1 Vote)


An Enterprise Architect project contains hundreds or thousands of elements. Name of these elements alone are often not enough to uniquely identify them. It is important to mark every element with its own unique code.

Enterprise Architect provides the Auto Naming and Auto Counters feature which efficiently generates code elements. The element number is determined by its type, each element type has its own sequence of numbers.


Unfortunately, the numbering according to the types of elements is not always sufficient. We often need sequences derived from first level components. For example, we have other sequence for 'Accounting' component use cases (UC-ACC001, UC-ACC002, ...) and other sequence for the "Billing" component use cases (UC-INV001, ...).


We implemented an extension for generating element codes based on existing element names.

The basic idea is to use the first specified code as a mask for the others. User has to name first element, for example:

UC-ACC001: Create an account

If user creates another use case, he does not need to know the final number. He uses a placeholder

UC-ACC*: Modify an Account


Finally, user runs extension "CCA Numbering", which replaces the placeholder with a new number.

Such a solution is much more general. You can have multiple sequences within a single element type. You can have a number sequences across different types of elements. This can be applied for example in Activity diagrams, if you want a uniform numbering for Activities and Actions together.



Solution code is attached. The program looks for the next element number directly in the project repository. The query syntax corresponds repository stored in the EAP file.

Any comments are welcome.


Petr Přibyl

CCA Group a.s.

This email address is being protected from spambots. You need JavaScript enabled to view it.


Read 7468 times Last modified on Tuesday, 30 August 2016 01:53

Latest from Petr Přibyl


  • Comment Link Petr Přibyl Thursday, 29 September 2016 07:31 posted by Petr Přibyl

    Thank you for your comment!

    I'm afraid solution basen on stereotypes is technically possible but too difficult to manage.

    Technical solution would be as follows
    - you have to implement rule settings - dialog similar to EA Auto Names Counters dialog extended by stereotype selection
    - you have to choose place for settings storage (we finally choosed tagged value on template package, we didn't dare to use EA repository database)
    - you have to implement EA_OnPostNewElement to start main numbering action

    User has next to do more settings
    - he has to set numbering rules for all types and stereotypes that should be autonumbered
    - he has to manage EA profiles properly - all numbered stereotyped objects have to be prepared in toolboxes

    I'm afraid it is a lot of work and too many rules to make it work. Espacially for us it is not suitable, because our numbering is based on subsystems (first level modules), not only on specific object types and subtypes.


  • Comment Link Helmut Ortmann Wednesday, 21 September 2016 04:58 posted by Helmut Ortmann

    I good idea to solve a common issue regarding e.g. requirements. The EA auto naming can't distinguish between different types (e.g. stereotypes). Let say Customer Requirements and Software Requirements. Each with unique names and possible different rules.

    My dream is:
    - Drag a Customer requirements on the canvas
    - The Addin detects the type (stereotype) finds the rule and autocompletes the name.

    Is this possible?

    Thanks for your Addin!


Login to post comments