Setting the ID in JS

Started by hkmsn, February 05, 2025, 08:45:40 AM

Previous topic - Next topic

hkmsn

Hello,

1. Trying to set the element ID and relationship Tos, Froms in relationships with a synthetic ID, this to maintain a relationship between the legacy portfolio and  design tools - i.e. use the same codesor codes generated in a way that maps to the orgs view of standards.

2. This is possible in the CSV loader, but I can't seem to do it in JS.

3. Am I missing something ?

4. Grateful for any comment.

Regards
Mark Nelson



Phil Beauvoir

#1
Hi Mark, I assume by "JS" you mean jArchi? If so, changing the ID of existing objects is not allowed as this could compromise the integrity of the model (the ID is used internally in the model itself, or in coArchi, third-party plug-ins, or when importing another model). Setting the ID of newly created objects is also not allowed in jArchi as jArchi creates unique IDs in the same way as when creating new objects in Archi itself to guarantee uniqueness and internal integrity. The CSV import is a special case to allow either new objects or reference existing ones.

Regards,

Phik
If you value and use Archi, please consider making a donation.
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Jean-Baptiste Sarrodie

Hi,

Quote from: hkmsn on February 05, 2025, 08:45:40 AMTrying to set the element ID and relationship Tos, Froms in relationships with a synthetic ID, this to maintain a relationship between the legacy portfolio and  design tools

This is a bad practice. The good one is to use properties for that (this also makes it possible to manage the cases where a single element is already known in several other tools with different IDs).

Regards,

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

hkmsn

Thanks for comments,

1. By JS I meant JArchi java script plugin.

2. Realize its possible to create a 'key' composite property, e.g. applicationID for component or something like, applicationID_applicationID_NNNN for component relationships.

3. The way I've been working around this is by loading skeleton elements and relationships as CSVs, then manipulating them with JArchi to update properties, think this is a bit ugly.

4. From a practical point, many orgs hold enterprise artifcats in spreadsheets, so being able to update back and forward, between legacy and the tool using keys based on real attributes has some advantage. The current approach is one-way, or requires storage of the Archi ID, or custom loaders that looks up the key property.

Jean-Baptiste Sarrodie

Hi,

Quote from: hkmsn on February 06, 2025, 07:57:29 AM4. From a practical point, many orgs hold enterprise artifcats in spreadsheets, so being able to update back and forward, between legacy and the tool using keys based on real attributes has some advantage. The current approach is one-way, or requires storage of the Archi ID, or custom loaders that looks up the key property.

Some years ago, I shared a script which supports this process: https://gist.github.com/jbsarrodie/77e1e6779ace738a15c0bdcf551d68ec

I have a newer version but haven't published it yet (I will in the future).

Regards,

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

hkmsn

Thanks,

Used your code a while back, it was a great help. Think had to edit to allow, relationships between app components when in different positions in relationship input file, (could be my misunderstanding). e.g.

Integration_ID    Consumer_App_ID    Provider_App_ID
A-1-99-100        1                  99

There could be a case for defining some sort of natural key with creation alert as updates come via loading and UI.  I've seen people using Archi and recreating the same elements, without realizing what's happening, multi use of the CSV loader will 'achieve' this...

Maybe simplest would be sweeping macro with param file, e.g. find all app components with same combo of  properties, etc

Just thoughts
Regards