Display text of another concept using Labels

Started by Manj75, July 29, 2021, 09:37:59 AM

Previous topic - Next topic

Manj75

I could not find if what I want to do is supported in the Label Expression, so thought I'd ask on the forum.

Concepts in the model has name, documentation and properties - I want to be able to reference other concepts attributes and use them, for example in a view I place a Note element but the text is populated using the Label referecing the text from another concept.

e.g.

Application Component:
  Name: App1
  Documentation: This is an example application
  Properties: Critical=High, Status=Active, etc

In a view that may even be showing App1 I want a Note element and the text is populated with a referenced concept's attributes:

Note element (but you could do this on any concept):
  Label: $App1{${documentation}} OR $App1{${name}} OR $App1{${property{Critical}}

The Note element is populated with the text of the given concept's attribute


The above label expression is just my way of showing what I'm hoping to achieve, and if this is support please let me know as I could not find it in the GITHub Label Expression guide.


Phil Beauvoir

#1
No, this isn't implemented as part of label expressions. The documentation at the wiki is a complete list of what is currently implemented:

https://github.com/archimatetool/archi/wiki/Label-Expressions
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Manj75

Phil - can I create a Feature Request for this? If you think it'll never make the roadmap then I won't bother.

I also had thoughts of another Feature Request similar to this but will raise it as a separate post.

Is it best to just raise a FR's on GitHub rather then pre-vetting with you and JB on this forum, as you look in at the issue and accept or reject anyway.

Phil Beauvoir

There are issues with referencing a concept by name:

- A concept name might not be unique (might exist as a different type)
- A concept name might change (ideally you'd want to reference the concept by its internal ID which is immutable)
- It will have a performance hit

The last one is a concern that I have overall with label expressions. As it is, every single change to the model updates every visible label which has an expression in case a referenced value change. This means parsing the expression with regex and doing some Java stuff to figure out references. If there are many Views open with many objects with label expressions it can slow things down in the UI. Searching for a concept by name requires iterating through the model in search of the concept. Multiply that by potentially several hundred expressions and performance can take a hit. I have been experimenting with using an ID->Object cache to speed things up, but this doesn't solve the issue of referencing a concept by its (mutable) name.

We'll probably do some more work on label expressions after Archi 4.9 so I'll investigate more then.

> Is it best to just raise a FR's on GitHub rather then pre-vetting with you and JB on this forum, as you look in at the issue and accept or reject anyway.

I don't mind. This forum might be more accessible to some users.
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,

Not exactly what you asked for, but if you have App1 in your view and have added a connection between App1 and your note, then you can reference the other side of the connection (thus App1) from the note's label.

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.

Manj75

JB - your suggestion is a clever way to achieve what I need.

However, I tried this and it does not work - am I doing something wrong...

On a single view I have both {application-component}, {Note} and {Connection]

App1 --- Connection --- Note

App1:Documentation = 'This is a sample documentation'

Note:Label = $target{documentation} - it does not show in the element, I even tried $target{name} with same blank.

I ensured that the direction of the connection had no impact so tried to connect in both way but same again.

Please let me know what I am doing wrong.

Thanks

Phil Beauvoir

You need to use this format:

$connection:source{documentation}

or

$connection:target{documentation}

See https://github.com/archimatetool/archi/wiki/Label-Expressions

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

Manj75

Thanks Phil - I was not looking at the table in the guide properly.

This covers all my scenarios :)